【问题标题】:Prompt for consent every time with google auth, Cordova + ionic 2每次使用 google auth、Cordova + ionic 2 都提示同意
【发布时间】:2017-09-21 06:50:21
【问题描述】:

我正在使用此 Cordova GooglePlus Plugin 登录 Google 帐户。问题是我只能在第一个请求中获取刷新令牌。我想每次都拥有这个令牌。

我读过添加prompt=consent 设置会使其在每次登录时都征求同意,并且我每次都可以获得刷新令牌。

我只是不知道在哪里添加这个设置来实现这一点。

我正在登录:

    let opts = {
        scopes: "SCOPE1 SCOPE2",
        webClientId: WEBCLIENTID,
        offline: true
    }
    GooglePlus.login(opts)

任何人都可以帮助我吗?

谢谢

【问题讨论】:

  • 你解决了吗?我遇到了同样的问题
  • 我得到了同样的帮助吗?

标签: cordova ionic2 google-signin google-plus-signin


【解决方案1】:

试试这个:

this.afAuth.auth .signInWithPopup(new firebase.auth.GoogleAuthProvider().setCustomParameters({prompt: 'select_account'})) .then((用户) => { // 你的逻辑代码在这里

    },(err) => {
      console.log("Error in auh service" + err);
     reject(err);
   })

【讨论】:

    【解决方案2】:

    您必须将其添加到authentication request

    您可以通过添加 prompt=consent 参数到身份验证请求。什么时候 prompt=consent 包括在内,每次都显示同意屏幕 用户登录到您的应用程序。因此,包括 prompt=consent 仅在必要时。

    Authentication URI parameters - consent

    【讨论】:

    • 嗨@Sampath,因为我使用的是插件,所以我认为我无法控制请求参数...
    猜你喜欢
    • 1970-01-01
    • 2018-05-12
    • 2016-11-24
    • 1970-01-01
    • 2017-09-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-18
    • 2018-02-16
    相关资源
    最近更新 更多