-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Revoke Token #34
Comments
Related to #30 Also check thephpleague/oauth2-client#479 for more info |
If they're OK with it in |
My questions would be: How would you specify what token to revoke?You can revoke either the access or the refresh token. I wouldn't do both just in case an error occurs and we need to report it to the user. Also the access token is needed for authentication. What should the return value look like?A 200 status code is considered a success, 503 should be taken as "retry later", neither of these specify a Body for the response so it should be ignored. Errors should be reported with a 400 (Bad Request) status code. A JSON Body will be attached with data for the errors. I still need to check these against Discord. Our options would be:
Some other parts of this provider throw errors as custom Exceptions, so that may be our best option? |
@pablomayobre What error may occur when revoking a token? I have just played around with the Discord OAuth2 server, and even if the passed token is wrong, it does not return any error (as expected, to be fair). The only possible errors are:
But then it, of course, depends on the specific implementation. In other words, if you want to provide an interface that revokes both tokens at once, then yes, there might be additional pitfalls. If not, it can be handled by the developer in the same way as retrieving the access token is being handled right now. That is to say, they handle any invalid response on their own. Either way, have you made any prototype? I have tried to implement this similarly to retrieving the access token. However, my implementation is incomplete as it depends on the A proper solution would have to provide an own Btw. I wonder if revoking the access token alone is enough. The RFC7009 proposal states the following:
If I understand it correctly, revoking the access token should automatically revoke the refresh token, too. Which is exactly what I experienced with Discord. Once the access token was revoked, the application disappeared from Authorised Apps. On the other hand, as this is not documented anywhere, it is undefined behavior. |
I haven't worked with this API nor with the implementation since I posted the original issue, basically I did exactly what I proposed with a few modifications. I invalidate both tokens just to be sure, and I have a catch for errors just in case. Even if they don't appear in the wild it may happen at some point due to rate limits or API changes on the Discord side or bad tokens in our DBs. The revoke API I implemented just takes the token and the type of token and does the HTTP request, and that was a good enough solution for my needs. Hopefully that's enough information but as I mentioned I don't have any strong opinions on this since I haven't been actively working on this in a long time (a year and a half) |
Hi, I was thinking that maybe having a revoke method on the Discord provider, to revoke an AccessToken.
Note that the AbstractProvider has no such method, but it could prove useful anyways.
I found a way to do this, but I haven't properly tested it yet:
This code is based on RFC7009.
Errors are further discussed in RFC6749 Section 5.2
Also this code doesn't revoke the Refresh Token and it probably should.
The text was updated successfully, but these errors were encountered: