This repository has been archived by the owner on Jan 2, 2025. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix unnecessary auth token refreshes after first expiry (#208)
Previously, `created_at` was only set once during cookie creation. As this value was never updated, once the initial token expires, the token would remain in a permanent state where it would always want a refresh for every subsequent request. When in this state, and two requests are launched, this can cause a race condition: both requests will try to refresh the token, and if the earlier request returns later, this will result in a broken cookie. Depending on when this happens in the race, this will usually result in either a credential error or refresh token deserialization error. In the app, this manifests itself as a `401 Unauthorized` response, requiring the user to log in every expiry period in order to fix the issue (8 hours by default for GitHub Apps). To fix this, we update `created_at` on token refresh, so that requests do not need to unnecessarily refresh the token after the first expiry. Co-authored-by: Gabriel Gordon-Hall <[email protected]>
- Loading branch information