Skip to content

Commit 976369d

Browse files
keywordnewdaffl
authored andcommitted
fix: check for undefined access token (#1571)
1 parent 42c13e2 commit 976369d

File tree

1 file changed

+4
-2
lines changed
  • packages/authentication/src

1 file changed

+4
-2
lines changed

packages/authentication/src/jwt.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ export class JWTStrategy extends AuthenticationBaseStrategy {
3232
const isValidLogout = event === 'logout' && connection.authentication && authResult &&
3333
connection.authentication.accessToken === authResult.accessToken;
3434

35-
if (authResult && event === 'login') {
36-
const { accessToken } = authResult;
35+
const { accessToken } = authResult || {};
36+
37+
if (accessToken && event === 'login') {
38+
debug('Adding authentication information to connection');
3739
const { exp } = await this.authentication.verifyAccessToken(accessToken);
3840
// The time (in ms) until the token expires
3941
const duration = (exp * 1000) - new Date().getTime();

0 commit comments

Comments
 (0)