aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firebase/Auth
diff options
context:
space:
mode:
Diffstat (limited to 'Firebase/Auth')
-rw-r--r--Firebase/Auth/CHANGELOG.md1
-rw-r--r--Firebase/Auth/Source/FIRUser.m8
2 files changed, 6 insertions, 3 deletions
diff --git a/Firebase/Auth/CHANGELOG.md b/Firebase/Auth/CHANGELOG.md
index 2669fc0..d5d0782 100644
--- a/Firebase/Auth/CHANGELOG.md
+++ b/Firebase/Auth/CHANGELOG.md
@@ -1,4 +1,5 @@
# v5.0.2
+- Fix an issue where JWT date timestamps weren't parsed correctly.
- Fix an issue where anonymous accounts weren't correctly promoted to
non-anonymous when linked with passwordless email auth accounts.
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