Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[token refresh] Compatibility with python “idan/oauthlib” #167

Open
wants to merge 23 commits into
base: develop
Choose a base branch
from
Open
Changes from 3 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion Sources/OAuth2Client/NXOAuth2Account.m
Original file line number Diff line number Diff line change
@@ -44,6 +44,14 @@ @implementation NXOAuth2Account (Private)

#pragma mark Lifecycle

-(void)dealloc
{
if (self == self->oauthClient.delegate)
{
self->oauthClient.delegate = nil;
}
}

- (instancetype)initAccountWithOAuthClient:(NXOAuth2Client *)anOAuthClient
accountType:(NSString *)anAccountType
application:(id<NXApplication>)app
@@ -62,7 +70,7 @@ - (instancetype)initAccountWithAccessToken:(NXOAuth2AccessToken *)anAccessToken
application:(id<NXApplication>)app
{
self = [super init];
if (self) {
if (nil != self) {
self.application = app;
accountType = anAccountType;
accessToken = anAccessToken;
7 changes: 7 additions & 0 deletions Sources/OAuth2Client/NXOAuth2AccountStore.m
Original file line number Diff line number Diff line change
@@ -144,6 +144,13 @@ -(instancetype)initWithApplication:(id)uiApplication
- (void)dealloc;
{
[[NSNotificationCenter defaultCenter] removeObserver:self];

NSArray* pendingClients = [self.pendingOAuthClients allValues];
[self.pendingOAuthClients removeAllObjects];
for (NXOAuth2Client* singleClient in pendingClients)
{
singleClient.delegate = nil;
}
}


4 changes: 4 additions & 0 deletions Sources/OAuth2Client/NXOAuth2Client.m
Original file line number Diff line number Diff line change
@@ -111,6 +111,10 @@ - (instancetype)initWithClientID:(NSString *)aClientId

- (void)dealloc;
{
if (self == authConnection.delegate)
{
authConnection.delegate = nil;
}
[authConnection cancel];
}

8 changes: 8 additions & 0 deletions Sources/OAuth2Client/NXOAuth2Request.m
Original file line number Diff line number Diff line change
@@ -75,6 +75,14 @@ - (instancetype)initWithResource:(NSURL *)aResource method:(NSString *)aMethod p

#pragma mark Signed NSURLRequest

-(void)dealloc
{
if (self == self.connection.delegate)
{
self.connection.delegate = nil;
}
}

- (NSURLRequest *)signedURLRequest;
{
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:self.resource];