diff options
author | Morgan Chen <morganchen12@gmail.com> | 2018-06-25 14:30:31 -0700 |
---|---|---|
committer | Morgan Chen <morganchen12@gmail.com> | 2018-06-25 14:32:54 -0700 |
commit | 17af03b58183f34ad1d1f0f46995315e67f43031 (patch) | |
tree | b0a39ffb5f4ba61e715136ef1f5447e39cb07333 /Firebase/Auth/Source | |
parent | f2c102887bb59074bc85a0473b93eb33f5244aac (diff) |
Fix bad JWT parsing
Diffstat (limited to 'Firebase/Auth/Source')
-rw-r--r-- | Firebase/Auth/Source/FIRUser.m | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Firebase/Auth/Source/FIRUser.m b/Firebase/Auth/Source/FIRUser.m index 3f5bf35..9bae744 100644 --- a/Firebase/Auth/Source/FIRUser.m +++ b/Firebase/Auth/Source/FIRUser.m @@ -890,12 +890,14 @@ static void callInMainThreadWithAuthDataResultAndError( return nil; } + // These are dates since 00:00:00 January 1 1970, as described by the Terminology section in + // the JWT spec. https://tools.ietf.org/html/rfc7519 NSDate *expDate = - [NSDate dateWithTimeIntervalSinceNow:[tokenPayloadDictionary[@"exp"] doubleValue]]; + [NSDate dateWithTimeIntervalSince1970:[tokenPayloadDictionary[@"exp"] doubleValue]]; NSDate *authDate = - [NSDate dateWithTimeIntervalSinceNow:[tokenPayloadDictionary[@"auth_time"] doubleValue]]; + [NSDate dateWithTimeIntervalSince1970:[tokenPayloadDictionary[@"auth_time"] doubleValue]]; NSDate *issuedDate = - [NSDate dateWithTimeIntervalSinceNow:[tokenPayloadDictionary[@"iat"] doubleValue]]; + [NSDate dateWithTimeIntervalSince1970:[tokenPayloadDictionary[@"iat"] doubleValue]]; FIRAuthTokenResult *result = [[FIRAuthTokenResult alloc] initWithToken:token expirationDate:expDate |