-
Notifications
You must be signed in to change notification settings - Fork 87
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
Keep refresh token if the server does not return a new one on token refresh #82
Comments
any updates on this issue? Steps to reproduce:
Possible Solution Why would one ever want to clear the whole |
no updates on this one? |
Guys is this thing resolved perhaps? |
we have this workaround in place public class TokenServiceStore: OAuthAccessTokenStore {
private let tokenKeychainStore: OAuthAccessTokenKeychainStore
public init(service: String) {
tokenKeychainStore = OAuthAccessTokenKeychainStore(service: service)
}
public func storeAccessToken(_ accessToken: OAuthAccessToken?) {
if let accessToken = accessToken, accessToken.refreshToken == nil, let oldRefreshToken = retrieveAccessToken()?.refreshToken {
tokenKeychainStore.storeAccessToken(OAuthAccessToken(accessToken: accessToken.accessToken, tokenType: accessToken.tokenType, expiresAt: accessToken.expiresAt, refreshToken: oldRefreshToken))
} else {
tokenKeychainStore.storeAccessToken(accessToken)
}
}
public func retrieveAccessToken() -> OAuthAccessToken? {
return tokenKeychainStore.retrieveAccessToken()
}
}
let heimdallr: Heimdallr = Heimdallr(..., accessTokenStore: TokenServiceStore(service: ...), ...) |
My authorization server doesn't always send a new refresh token when refreshing access tokens (as allowed by the spec). When it doesn't, Heimdallr overrides the stored refresh token with nil.
This causes the next refresh to fail with a
HeimdallrErrorNotAuthorized
error.I'll try to work on a PR for a fix. Let me know what you think.
The text was updated successfully, but these errors were encountered: