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.
This commit is contained in:
0xA455
2016-04-05 19:12:15 -04:00
committed by Drew
parent 1eb2a87f9f
commit 1bd804693c

View File

@@ -64,7 +64,7 @@ var getAuthForSessionToken = function({ config, sessionToken, installationId } =
}
var now = new Date(),
expiresAt = new Date(results[0].expiresAt.iso);
expiresAt = results[0].expiresAt ? new Date(results[0].expiresAt.iso) : undefined;
if(expiresAt < now) {
throw new Parse.Error(Parse.Error.INVALID_SESSION_TOKEN,
'Session token is expired.');