Skip to content

Commit

Permalink
Fixes [Issue #367](#367) where expired refresh tokens were not cleare…
Browse files Browse the repository at this point in the history
…d, preventing re-authorization.
  • Loading branch information
josephquigley committed Oct 4, 2023
1 parent fe01ca6 commit 01e8a9b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Sources/Flows/OAuth2.swift
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,9 @@ open class OAuth2: OAuth2Base {
callback(json, nil)
}
catch let error {
// Fixes [Issue #367](https://github.com/p2/OAuth2/issues/367)
// Refresh token needs to be cleared out upon error, otherwise re-authorizing will not ocurr because the library thinks it has a valid refresh token and tries to fetch a new access token with an expired refresh token.
self.clientConfig.refreshToken = nil
self.logger?.debug("OAuth2", msg: "Error refreshing access token: \(error)")
callback(nil, error.asOAuth2Error)
}
Expand Down

0 comments on commit 01e8a9b

Please sign in to comment.