Skip to content

Commit 22b8f27

Browse files
committed
Dont go through authentication flow when we have token from the keychain
- but still see if he's not yet expired
1 parent 3fc2e2a commit 22b8f27

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Sources/OAuth2Client/NXOAuth2Client.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,11 @@ - (void)setAccessToken:(NXOAuth2AccessToken *)value;
119119

120120
- (void)requestAccess;
121121
{
122-
if (username != nil && password != nil) { // username password flow
122+
if (self.accessToken) {
123+
if (self.accessToken.hasExpired){
124+
[self refreshAccessToken];
125+
}
126+
} else if (username != nil && password != nil) { // username password flow
123127
[self requestTokenWithUsernameAndPassword];
124128
} else { // web server flow
125129
NSAssert(redirectURL, @"Web server flow without redirectURL");

0 commit comments

Comments
 (0)