Skip to content

Commit

Permalink
fix: check for undefined access token (#1571)
Browse files Browse the repository at this point in the history
  • Loading branch information
keywordnew authored and daffl committed Sep 21, 2019
1 parent 42c13e2 commit 976369d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/authentication/src/jwt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ export class JWTStrategy extends AuthenticationBaseStrategy {
const isValidLogout = event === 'logout' && connection.authentication && authResult &&
connection.authentication.accessToken === authResult.accessToken;

if (authResult && event === 'login') {
const { accessToken } = authResult;
const { accessToken } = authResult || {};

if (accessToken && event === 'login') {
debug('Adding authentication information to connection');
const { exp } = await this.authentication.verifyAccessToken(accessToken);
// The time (in ms) until the token expires
const duration = (exp * 1000) - new Date().getTime();
Expand Down

0 comments on commit 976369d

Please sign in to comment.