cordova - 每次使用 google auth、Cordova + ionic 2 提示同意

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

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

我读过添加 prompt=consent设置将使它在每次登录时都征求同意,我每次都能获得刷新 token 。

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

我正在登录:

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

任何人都可以帮我解决这个问题吗?

谢谢

最佳答案

您必须将其添加到 authentication request .

You can prompt the user to re-authorize your app by adding the prompt=consent parameter to the authentication request. When prompt=consent is included, the consent screen is displayed every time the user logs into your app. For this reason, include prompt=consent only when necessary.



Authentication URI parameters - consent

关于cordova - 每次使用 google auth、Cordova + ionic 2 提示同意,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43590630/

相关文章:

android - 使用后端服务器进行身份验证的正确方法

Android phonegap 项目垃圾邮件 QTAGUID 消息

android - 如何在 Cordova 插件中设置图像

google-maps - 谷歌地图只加载第一次,第二次是灰色的

firebase - 当我在rxdart中调用currentUser和Observable错误时,FirebaseAuth引发错误

ios - 在自定义 .plist 文件中使用用户定义的build设置

javascript - 如何在 ionic 中的 app.run() 中包含 HTTP 请求

javascript - cordova 中 fileSystem.root.getFile 的错误代码

android - ionic - 错误 : No resource found that matches the given name (at ‘dialogCornerRadius’ with value ‘?android:attr/dialogCornerRadius’ )

ios - ionic 2 - 字体未在 iOS 上显示