Skip to content

Commit ddfdc11

Browse files
committed
added some helper methods when we have a token but not client
1 parent 9fe1991 commit ddfdc11

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

NXOAuth2Account+Private.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,8 @@
1414
#import "NXOAuth2Account.h"
1515

1616
@interface NXOAuth2Account (Private)
17+
1718
- (id)initAccountWithOAuthClient:(NXOAuth2Client *)oauthClient accountType:(NSString *)accountType;
19+
- (id)initAccountWithAccessToken:(NXOAuth2AccessToken *)accessToken accountType:(NSString *)accountType;
20+
1821
@end

Sources/OAuth2Client/NXOAuth2Account.m

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,21 @@ @implementation NXOAuth2Account (Private)
4242
#pragma mark Lifecycle
4343

4444
- (id)initAccountWithOAuthClient:(NXOAuth2Client *)anOAuthClient accountType:(NSString *)anAccountType;
45+
{
46+
self = [self initAccountWithAccessToken:anOAuthClient.accessToken
47+
accountType:anAccountType];
48+
if (self) {
49+
oauthClient = anOAuthClient;
50+
}
51+
return self;
52+
}
53+
54+
- (id)initAccountWithAccessToken:(NXOAuth2AccessToken *)anAccessToken accountType:(NSString *)anAccountType;
4555
{
4656
self = [super init];
4757
if (self) {
4858
accountType = anAccountType;
49-
oauthClient = anOAuthClient;
50-
accessToken = oauthClient.accessToken;
59+
accessToken = anAccessToken;
5160
oauthClient.delegate = self;
5261
identifier = [NSString nxoauth2_stringWithUUID];
5362
}

0 commit comments

Comments
 (0)