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

ux_mode not an option parameter for gapi.auth2.init #162

Open
monisha3107 opened this issue Nov 3, 2017 · 1 comment
Open

ux_mode not an option parameter for gapi.auth2.init #162

monisha3107 opened this issue Nov 3, 2017 · 1 comment

Comments

@monisha3107
Copy link

I am trying to avoid a browser pop-up and use ux_mode='redirect' during init() or signIn() and it seems like I cannot use this as one of the option parameters to either of those methods. Has this been removed/modified?

index.html has this and loads appcomponent.html:
<script src="https://apis.google.com/js/platform.js" async defer></script>

appcomponent.html has this:

<google-signin id="signin"
               style="display: inline-block;"
               [clientId]="clientId"
               [scope]="scope"
               (googleSignInSuccess)="onGoogleSignIn()">
</google-signin>

<button style="float:right; height: 36px; display: inline-block;" class="btn btn-default" (click)="onGoogleSignOut();">Sign out</button>

And appcomponent.ts has the following:

onGoogleSignIn() {

   let googleAuth = gapi.auth2.getAuthInstance();
   this.user = googleAuth.currentUser.get();

   if (googleAuth.currentUser.get().isSignedIn()) {
     googleAuth.signIn().then((data) => {
       this.token = data.Zi.access_token;
     });
   }
   else
   {
     let authResp = this.user.getAuthResponse();
     this.token = authResp.access_token;
   }
 }

 onGoogleSignOut() {
   gapi.auth2.getAuthInstance().signOut().then(function () {
     console.log('User signed out.');
   });
 }

This works just fine. But I wanted to not have the pop-up and instead have the user be redirected to another page to select the google account to login with. So, I was trying to specify ux_mode in the signIn() parameters or add in a onLoad() function with init().

@dman777
Copy link

dman777 commented Aug 4, 2018

I get the pop-up using Polymer 1 with:

    <google-signin
          on-google-signin-success="googleSignInSuccess"
          client-id="333-foo.apps.googleusercontent.com"
          label-signin="Login with Google"
        ></google-signin>

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

2 participants