Skip to content

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

@monisha3107

Description

@monisha3107

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().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions