Skip to content
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

Fixes #1318 by multiplying decreaseExpirationBySec with 1000. Also fixes returning true for calling hasValidAccessToken on tokens which are already expired #1374

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions projects/lib/src/oauth-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2268,7 +2268,7 @@ export class OAuthService extends AuthConfig implements OnDestroy {

if (
issuedAtMSec - clockSkewInMSec >= now ||
expiresAtMSec + clockSkewInMSec - this.decreaseExpirationBySec <= now
expiresAtMSec + clockSkewInMSec - this.decreaseExpirationBySec * 1000 <= now
) {
const err = 'Token has expired';
console.error(err);
Expand Down Expand Up @@ -2424,8 +2424,7 @@ export class OAuthService extends AuthConfig implements OnDestroy {
const now = this.dateTimeService.new();
if (
expiresAt &&
parseInt(expiresAt, 10) - this.decreaseExpirationBySec <
now.getTime() - this.getClockSkewInMsec()
parseInt(expiresAt, 10) - this.decreaseExpirationBySec * 1000 < now.getTime()
) {
return false;
}
Expand Down