How to open "Sign-in with your Google account" page like present model View when I press "Sign in with Google"?

| | August 7, 2015

In my current app, I am using “Sign-in with Google”. I always want to open that “Sign-in with your Google account” page in type present model ViewController even if I installed google apps like “Google+ “.

But now what’s happening in my app is if I already sign into Google+ app, which is already installed, it is opening that app instead of “Sign-in with Google” page. This means that it’s coming from out of my app and opening the Google+ app. I don’t want that.

Here is my code:

GIDSignIn *signIn = [GIDSignIn sharedInstance];
signIn.clientID = kClientId;
signIn.allowsSignInWithBrowser = YES;
signIn.scopes = @[@"https://www.googleapis.com/auth/plus.login",@"https://www.googleapis.com/auth/plus.me",@"https://www.googleapis.com/auth/userinfo.email"];
signIn.delegate = self;
[signIn signIn];

My app goal is every time I need to open “Sign-in with Google” page rather than Google apps when I click on “Sign in with Google” button.

One Response to “How to open "Sign-in with your Google account" page like present model View when I press "Sign in with Google"?”

  1. I have a project using Google Signin Integration with the same problem.
    First, you need to know clearly about how Google Signin SDK working.
    You can see the reference from Ian Barber here: Login through google plus to native app does not shows login page every time?

    So here is my solution:

    Every times I open the login view, after setting Google Signin configurations in ViewDidLoad, I call function “[signin logout]” to log out the current user.

    - (void)viewDidLoad {
        [super viewDidLoad];
        //Configure Google Signin
        GIDSignIn *signin = [GIDSignIn sharedInstance];
        //Sign out
        [signin signOut];
        signin.delegate = self;
        signin.uiDelegate = self;
    }
    

    Hope this will be helpful for you!

Leave a Reply