Skip to content

Commit

Permalink
feat: use <= for auto refresh token threshold (#716)
Browse files Browse the repository at this point in the history
Auto refresh should be attempted when the threshold is reached, not
after it is reached.
  • Loading branch information
hf committed Jun 29, 2023
1 parent c990bc2 commit 4c2b3c6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/GoTrueClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1642,10 +1642,10 @@ export default class GoTrueClient {

this._debug(
'#_autoRefreshTokenTick()',
`access token expires in ${expiresInTicks}, a tick lasts ${AUTO_REFRESH_TICK_DURATION}ms, refresh threshold is ${AUTO_REFRESH_TICK_THRESHOLD} ticks`
`access token expires in ${expiresInTicks} ticks, a tick lasts ${AUTO_REFRESH_TICK_DURATION}ms, refresh threshold is ${AUTO_REFRESH_TICK_THRESHOLD} ticks`
)

if (expiresInTicks < AUTO_REFRESH_TICK_THRESHOLD) {
if (expiresInTicks <= AUTO_REFRESH_TICK_THRESHOLD) {
await this._callRefreshToken(session.refresh_token)
}
} catch (e: any) {
Expand Down

0 comments on commit 4c2b3c6

Please sign in to comment.