-
Notifications
You must be signed in to change notification settings - Fork 1k
Token refresh can cause automatic authStyle detection to break #718
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
Comments
This is a workaround for golang/oauth2#718
unfortunate, but i think if that's the case, it'd be better to explicitly specify the authstyle required |
@seankhliao Explicitly specifying the authStyle is only a viable solution when the provider is known in advance. In my case, the user specifies an OpenID discovery URL and expects the application to figure everything out on its own. If specifying the |
I think it's regrettable that it was added at all, though we aren't going to remove it. |
Note that per rfc https://datatracker.ietf.org/doc/html/rfc6749#section-2.3.1
Probing for any other support is a nice to have, but ultimately works around non compliant servers. |
Ah ok, thanks for the clarification, I was not aware of that development happening in the mean time 👍 |
retrieveToken
is called in two situations:In both cases,
internal.RetrieveToken
is called, which then performs auto-detection ofauthType
when not explicitly configured.The problem now is, that some providers allow to perform token refresh without additional authentication. They're perfectly happy when the refresh token is valid and thus they successfully return a valid token even when the wrong
authType
is used. This leads to caching the wrongauthStyle
when a token refresh is performed BEFORE the first token exchange.This can happen after the application is restarted while users still have valid refresh tokens (e.g. in the browser session). If the application then issues a token refresh before a new signin is performed, the errornous caching will cause ALL future token exchanges to fail as it will keep using the wrong
authStyle
.I encountered this with Azure AD and the v2.0 issuer.
The text was updated successfully, but these errors were encountered: