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:
@@ -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.');
|
||||
|
||||
Reference in New Issue
Block a user