Skip to content
Merged
Changes from all commits
Commits
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
27 changes: 26 additions & 1 deletion Sources/OAuth2Client/NXOAuth2AccountStore.m
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ - (void)oauthClientNeedsAuthentication:(NXOAuth2Client *)client;
#endif
}

- (void)oauthClientDidGetAccessToken:(NXOAuth2Client *)client;
- (void)oauthClientDidGetAccessToken:(NXOAuth2Client *)client
{
NSString *accountType;
@synchronized (self.pendingOAuthClients) {
Expand All @@ -498,6 +498,31 @@ - (void)oauthClientDidGetAccessToken:(NXOAuth2Client *)client;
[self addAccount:account];
}

- (void)oauthClientDidRefreshAccessToken:(NXOAuth2Client *)client
{
NXOAuth2Account* foundAccount = nil;

@synchronized (self.accountsDict)
{
for (NXOAuth2Account* account in self.accounts)
{
if (account.oauthClient == client)
{
foundAccount = account;
break;
}
}
}

foundAccount.accessToken = client.accessToken;
NSDictionary *userInfo = [NSDictionary dictionaryWithObject: foundAccount
forKey: NXOAuth2AccountStoreNewAccountUserInfoKey];

[[NSNotificationCenter defaultCenter] postNotificationName:NXOAuth2AccountStoreAccountsDidChangeNotification
object:self
userInfo:userInfo];
}

- (void)addAccount:(NXOAuth2Account *)account;
{
@synchronized (self.accountsDict) {
Expand Down