bshaffer / oauth2-server-php

A library for implementing an OAuth2 Server in php
http://bshaffer.github.io/oauth2-server-php-docs
MIT License
3.26k stars 950 forks source link

Is it "allowed" to modify the scope of the token in the database once it has been created? #895

Closed jahrralf closed 6 years ago

jahrralf commented 7 years ago

Scenario: I have an app working with a PHP backend. When the user logs in, I can only check a receipt of an in-app purchase which has already been uploaded to the server to see "if he/she is premium" or not. If I see that the subscription in the receipt has expired I need to get a newer one. This should happen as infrequently as possible as the user always has to re-enter his itunes password (on iOS) so that I can get the receipt.

My plan would be:

bshaffer commented 6 years ago

There isn't a precedent in the spec to modify scopes one issued. There is only the concept of downgrading scopes, e.g. if you have a refresh token with scope "thing1, thing2", you can use that to get an access token with only scope "thing1" or only scope "thing2".

There's a better way to accomplish what you want. For instance, if your access token is tied to a user, check the user for the subscription status.