Search code examples
ionic-frameworkgoogle-plus-signin

When sign in with google plus getting an error '10'


When I sign in with google. I am getting the popup of gmail list but when I select any gmail. I get an error as 10.

.ts file

import { GooglePlus } from '@ionic-native/google-plus/ngx'; 

    loginWithGP(){

       this.googlePlus.login({
          'webClientId': '#####', //reverse client id
          'offline': true
        }).then(res=>{
          console.log('res', res)
          this.userInfo=res;
          this.isUserLoggedIn=true;
          }).catch( err => console.log(err ,'error'));
    }

.html file

    <ion-card *ngIf="isUserLoggedIn" style="text-align:center">
      <img [src]="userInfo.imageUrl" />
      <h3>{{userInfo.displayName}}</h3>
      <p>{{userInfo.email}}</p>
      <ion-button ion-button clear (click)="logout()">Logout</ion-button>
    </ion-card>

    <ion-footer *ngIf="!isUserLoggedIn">
      <ion-button ion-button block (click)="loginWithGP()">Login with Google+</ion-button>
    </ion-footer>

Solution

  • its occurred mismatch about your SHA-1 key mismatch with app id or your release or debug key

    ionic cordova plugin add cordova-plugin-googleplus --variable REVERSED_CLIENT_ID=279073034910-0000000000000000000.apps.googleusercontent.com
    
    npm install --save @ionic-native/google-plus@4
    

    enter image description here

    Note: in ionic youcan find packagename config.xml top of it widget id="com.your.id"