使用 google 登录时出现错误“10”
When sign in with google plus getting an error '10'
当我使用 google 登录时。我收到 gmail 列表的弹出窗口,但是当我 select 任何 gmail 时。我收到错误 10.
.ts 文件
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 文件
<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>
您的 SHA-1 密钥与应用 ID 或您的发布或调试密钥不匹配发生了不匹配
ionic cordova plugin add cordova-plugin-googleplus --variable REVERSED_CLIENT_ID=279073034910-0000000000000000000.apps.googleusercontent.com
npm install --save @ionic-native/google-plus@4
注意: 在 ionic 中你可以找到 packagename
config.xml 顶部 widget id="com.your.id"
当我使用 google 登录时。我收到 gmail 列表的弹出窗口,但是当我 select 任何 gmail 时。我收到错误 10.
.ts 文件
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 文件
<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>
您的 SHA-1 密钥与应用 ID 或您的发布或调试密钥不匹配发生了不匹配
ionic cordova plugin add cordova-plugin-googleplus --variable REVERSED_CLIENT_ID=279073034910-0000000000000000000.apps.googleusercontent.com
npm install --save @ionic-native/google-plus@4
注意: 在 ionic 中你可以找到 packagename
config.xml 顶部 widget id="com.your.id"