Skip to content

Commit 1bd8046

Browse files
0x82858edrew-gross
authored andcommitted
Fix exception with non-expiring session tokens.
Session tokens generated by Parse with with "Expire inactive session" set to No leave the the expiresAt field undefined. This fixes the TypeError "Cannot read property 'iso' of undefined'" exception thrown when trying to use a session token with undefined expiresAt.
1 parent 1eb2a87 commit 1bd8046

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Auth.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ var getAuthForSessionToken = function({ config, sessionToken, installationId } =
6464
}
6565

6666
var now = new Date(),
67-
expiresAt = new Date(results[0].expiresAt.iso);
67+
expiresAt = results[0].expiresAt ? new Date(results[0].expiresAt.iso) : undefined;
6868
if(expiresAt < now) {
6969
throw new Parse.Error(Parse.Error.INVALID_SESSION_TOKEN,
7070
'Session token is expired.');

0 commit comments

Comments
 (0)