-
Notifications
You must be signed in to change notification settings - Fork 0
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
Refresh token in oauth2 auth_code grant #48
Comments
I would add that we can still do something like this with |
Also curently |
Agreed with the last comment (and pretty much agree also with the proposal). Again, if we were to do this, I can't currently come up with a pretty solution that wouldn't be a huge B/C break. Pretty solution, IMO, would be to rename the current offline mode Which would be a B/C break, because apps would expect the current implementation under How should we go about this, if we were to "fix" this? On the other hand, this (implementing a proper |
I'm aware that this has no "pretty" solution without breaking B/C, but I thought this is something we ought to talk about. My suggestion:
Speaking for Reglendo: We use mergado/mergado-api-client-php and it already works with "offline_token" grant the same as with "refresh_token" (it just rewrites it to "refresh_token") $offlineToken = $this->provider->getAccessToken("refresh_token", [ //works with "offline_token"
"entity_id" => $entityId
]); So on our side it changing just the name of that grant would be as simple as changing it along with some minor tweaks in MergadoProvider in mergado/mergado-api-client-php and running Implementing the new |
Current situation:
How we authorize with
auth_code
grant:Finding out our
access_token
expired on form submit.Problem:
The situation described is quite common: User works in app for long period of time and his access_token expired during that and we need to make full auth_code redirect flow. This is not that much of a problem if he is just reads static pages that he get with GET method, but is quite disruptive during POST/PATCH request such as form submission.
Solution
In oauth2 specification there is also
refresh_token
inauth_code
grant type. Although it is optional it's quite common to see it with widespread oauth2 providers and would be perfect fit for our problem.Auth flow with refresh token:
Refreshing
access_token
on form submission (example):I tried to figure out other possible solutions to this kind of problem, like storing apps state in
localStorage
with some indicator of action the user intended to take, so when it could be repeated after we have obtained new token, but this is very unpractical (and might have a few catches also). This is also linked to issue #47 (problem withlocalStorage
in Mergado apps).Conclusion:
If you would implement
refresh_token
intoauth_code
oauth2 grant, that would be great.The text was updated successfully, but these errors were encountered: