Skip to content

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

Open
@visionscaper

Description

@visionscaper

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions