Google OAuth for iOS

171 Views Asked by At

I'm developing an iOS app, where I would like to have both Facebook and Google OAuth as login. I'm working on Facebook OAuth, but I don't have any idea about the Google OAuth. Any help on this would be very helpful.

1

There are 1 best solutions below

0
On

Important : Google + API sign in and share do without leaving app. that is key element in avoiding app rejection.

Step 1 : Add Google+ client ID

Step 2 : Google+ Sign In delegates

-(void)finishedWithAuth: (GTMOAuth2Authentication *)auth
                  error: (NSError *) error
{

}

Step 3 : In App delegate

- (BOOL)  application:(UIApplication *)application
              openURL:(NSURL *)url
    sourceApplication:(NSString *)sourceApplication
           annotation:(id)annotation {

     if ([[url scheme] isEqualToString:FBTOKEN]) {
        return [FBSession.activeSession handleOpenURL:url];

        return [FBAppCall handleOpenURL:url
                      sourceApplication:sourceApplication
                            withSession:FBSession.activeSession];
    }
    else { 
            [GPPURLHandler handleURL:url sourceApplication:sourceApplication annotation:annotation];

    }
  return YES;
}