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

Implement handleNotification to ensure compatibility with iOS 10 and earlier #31

Merged
merged 4 commits into from
Sep 4, 2018
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
id="edu.berkeley.eecs.emission.cordova.auth"
version="1.3.0">
version="1.3.1">

<name>JWTAuth</name>
<description>Get the user email and associated JWT tokens from both native
Expand Down
10 changes: 9 additions & 1 deletion src/ios/OpenIDAuth.m
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,15 @@ - (nullable OIDAuthState *)getAuthState {

-(void)handleNotification:(NSNotification *)notification
{
[self logMessage:@"OpenIDAuth Error: handleNotification should not be called!"];
// For compatibility with iOS 10 and earlier
NSURL* url = [notification object];
if ([url.scheme isEqualToString:@"emission.auth"]) {
if([self.currentAuthorizationFlow resumeAuthorizationFlowWithURL:url]) {
self.currentAuthorizationFlow = nil;
} else {
[LocalNotificationManager addNotification:[NSString stringWithFormat:@"[iOS Auth] Resuming authorization flow failed with redirect URL: %@", url]];
}
}
}

- (NSString*) getStoredUsername
Expand Down