当我调用google-plus的登录功能时出错

问题描述 投票:1回答:1

我正在使用ionic4创建一个使用google-plus api登录的android /浏览器应用程序。我设法设置添加模块所需的配置(webClientId和反向...)

继承人的导入和配置

import { GooglePlus } from '@ionic-native/google-plus/ngx' ;
import { AngularFireModule } from 'angularfire2';
import { AngularFireAuth } from 'angularfire2/auth';
import firebase from 'firebase' ;
export const firebaseConfig2={
  apiKey: "***",
  authDomain: "**-**.firebaseapp.com",
  databaseURL: "https://***-**.firebaseio.com",
  projectId: "winwin-***",
  storageBucket: "winwin-****.appspot.com",
  messagingSenderId: "******"
}
firebase.initializeApp(firebaseConfig2)
************
  imports: [
      BrowserModule,
      HttpClientModule,
      HttpModule,
      IonicModule.forRoot(MyApp,{
        tabsPlacement: 'top',
      }),
      IonicStorageModule.forRoot(),
      AngularFireModule.initializeApp(firebaseConfig2),
    ],
    *********
providers: [
 ******
    Geolocation,
    GooglePlus,
    AngularFireAuth 

  ]

我在浏览器和android中遇到同样的错误(cordova运行浏览器/ android)

LoginPage.html:19 ERROR TypeError: Object(...) is not a function
at GooglePlus.login (index.js:27)
at LoginPage.webpackJsonp.64.LoginPage.loginfirebase (login.ts:45)
at Object.eval [as handleEvent] (LoginPage.html:19)
at handleEvent (core.js:13589)
at callWithDebugContext (core.js:15098)
at Object.debugHandleEvent [as handleEvent] (core.js:14685)
at dispatchEvent (core.js:10004)
at core.js:10629
at HTMLButtonElement.<anonymous> (platform-browser.js:2628)
at t.invokeTask (polyfills.js:3)

    loginGoogle(){
      this.googleplus.login({
        'webClientId':'****-*****.apps.googleusercontent.com',
        'offline':true
      }).then(res=>{
        firebase.auth().signInWithCredential(firebase.auth.GoogleAuthProvider.credential(res.idToken))
        .then(suc=>{
          alert('HALLALOUYA')
          }).catch(ns=>{
            alert ('not succ')
          })
        })

    }

我没有找到任何有这个错误的人的问题 无法判断我是否有插件版本错误或我搞砸了配置。

javascript firebase cordova ionic-framework google-plus
1个回答
2
投票

从2019年3月开始,将不再支持使用Google Plus登录,并且可能会在此之前停止使用。你应该migrate到谷歌登录。

© www.soinside.com 2019 - 2024. All rights reserved.