Skip to content


Subversion checkout URL

You can clone with
Download ZIP


If an expired cached token is initialized, expiration time is ignored #24

merged 3 commits into from

2 participants


PhAuthenticationToken init method was setting token's expiry date to nil if secondsToExpiry was negative.

However PhFacebook.m is assuming that token is valid when expiry is nil:

if (_authToken.expiry == nil || [[_authToken.expiry laterDate: [NSDate date]] isEqual: _authToken.expiry])
    validToken = YES;

Just noticed this was introduced in pull request #16. So possibly this fix as-it-is may break something else... didn't have time to investigate yet. Maybe you have other ideas how to fix it?

@philippec philippec merged commit 81365fa into philippec:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 3 deletions.
  1. +3 −2 classes/PhAuthenticationToken.m
  2. +1 −1  classes/PhFacebook.m
5 classes/PhAuthenticationToken.m
@@ -17,10 +17,11 @@ @implementation PhAuthenticationToken
- (id) initWithToken: (NSString*) token secondsToExpiry: (NSTimeInterval) seconds permissions: (NSString*) perms
- if ((self == [super init]))
+ if ((self = [super init]))
self.authenticationToken = token;
- if (seconds > 0)
+ if (seconds != 0)
self.expiry = [NSDate dateWithTimeIntervalSinceNow: seconds];
self.permissions = perms;
2  classes/PhFacebook.m
@@ -22,7 +22,7 @@ @implementation PhFacebook
- (id) initWithApplicationID: (NSString*) appID delegate: (id) delegate
- if ((self == [super init]))
+ if ((self = [super init]))
if (appID)
_appID = [[NSString stringWithString: appID] retain];
Something went wrong with that request. Please try again.