首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >调用google-plus的登录函数时出错

调用google-plus的登录函数时出错
EN

Stack Overflow用户
提问于 2019-01-08 20:59:42
回答 2查看 708关注 0票数 2

我正在使用ionic4创建一个android/浏览器应用程序,该应用程序使用google+ api进行登录。我设法设置了添加模块所需的配置(webClientId和反之亦然... )

下面是导入和配置

代码语言:javascript
复制
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 )

代码语言:javascript
复制
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')
          })
        })

    }

问题是我找不到任何有这个错误的人

我不知道我是否有一个插件版本错误或我已经搞乱了配置。

EN

回答 2

Stack Overflow用户

发布于 2019-01-08 21:53:27

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

票数 1
EN

Stack Overflow用户

发布于 2021-01-26 14:28:44

对我来说,这是安装@ For native/google-plus时的版本不匹配

如果您使用的不是Ionic 5,则需要获取更早的版本。具体是哪一个?

对于Ionic 3.9,npm i @ionic-native/google-plus@4.16是有效的。

对于4.0,我想你可以尝试4.20.0。关键是在安装之后,查看node_modules\@ionic-native\google-plus\package.json并在peepDependencies下检查,以查看您的项目是否符合所有要求。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54092352

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档