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

Handling of redirect URL after authentication not implemented in plugin ... (yet?) #2

Open
visionscaper opened this issue Oct 7, 2014 · 0 comments

Comments

@visionscaper
Copy link

Hello,

Thank you for sharing this plugin.

I was trying to use your plugin in an iOS app and managed Google+ to correctly redirect back to the app after authentication. However, I found that handling of the redirect URL was completely missing from the plugin.

In the entry point to the app (in AppDelegate.m):
-(BOOL)application: (UIApplication *)application openURL: (NSURL *)url sourceApplication: (NSString *)sourceApplication annotation: (id)annotation { ... }

... the redirect URL needs to be handled. However, the default functionality of Cordova that is called in this entry point:

[[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPluginHandleOpenURLNotification object:url]];

... only provides the means to propagate the url (or is expected to only provide the url), and not the sourceApplication and the annotation, while this is required to handle the url:

[GPPURLHandler handleURL:url sourceApplication:sourceApplication annotation:annotation];

So, I solved it as follows. In the entry point to the app, I added:

GoogleConnectPlugin* gcp = (GoogleConnectPlugin*)[[self.viewController pluginObjects] objectForKey:@"GoogleConnectPlugin"];

if ([gcp isSigningIn]) {
    [GPPURLHandler handleURL:url sourceApplication:sourceApplication annotation:annotation];
}

... and subsequently added functionality to the plugin to keep the isSigningIn state.

Was I missing something, or do you maybe have a better solution in mind?

Thanks in advance!

-- Freddy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant