【问题标题】:Google OAuth Client with Angular/Ionic: How do I find the redirect_uri?带有 Angular/Ionic 的 Google OAuth 客户端:如何找到 redirect_uri?
【发布时间】:2017-03-08 06:26:14
【问题描述】:

我有一个Ionic2 应用程序,我想将GooglePlus Authentication 添加到。

我收到以下错误:

据我了解,是因为我没有设置redirect_uri

问题

我应该为 Ionic2 应用程序使用什么 redirect_uri (Authorized redirect URIs)?我在哪里可以找到它?

以下适用于Facebook登录。

更新

按照these 的说明,我将REVERSED_CLIENT_ID 更改为以下格式:

"com.googleusercontent.apps.uniqueId"

所以我认为我已经取得了进步。

我现在在iOS 中收到以下错误:

从阅读here 来看,这意味着不应为Web Application here 创建credentials。但是如果我为iOS 创建它,这将如何为Android 工作?还是Android 不使用这些凭据?

对于Android,当我尝试登录时,我只是得到一个异常,并显示undefined 错误消息。

所以我有两个问题

  1. 我是否需要创建iOS 客户端ID here 而不是Web application

  1. 如何为Android 配置或调试此功能?

更新

对于iOS,我添加了iOS Client Id 并更改了我的反向客户端ID 以匹配,并且与Android 一样,它提示我登录我的Google 帐户。所以这看起来像是进一步的进步。

但是,一旦我登录后,就像使用 Android 一样,现在我收到一条异常消息,消息为 undefined。但是,在Xcode 控制台中,我确实得到了以下信息:

com.google.HTTPStatus 错误 400。

these 之后,我现在为iOSAndroid 创建了凭据。

我已经在新 ID 中配置了 AndroidiOS ID。

我在两个Android and iOS 上都收到一个异常,消息为undefined

更新

让它为iOS 工作。调用login 时的webClientId 选项不能是反转的客户端ID,而是客户端ID。

        GooglePlus.login({
            'webClientId': 'xxxxx.apps.googleusercontent.com',
            'offline': true
        }).then(googleData => {

现在要弄清楚为什么Android 不起作用。

在 Android 中,我现在得到 error = 12501(我认为这是我的密钥库出现问题的结果)。

更新

我生成密钥库。根据these 的说明,我将SHA1 复制到Signing-certificate fingerprint。但还是得到error = 12501

【问题讨论】:

  • Josh Morony 在此写了一篇文章。也许它可以为您提供一些启示:joshmorony.com/…

标签: angular ionic2 google-plus-signin


【解决方案1】:

当你开始使用 iOS 时,这里是 Android 的解决方案。

为您的应用构建 APK,然后运行此命令-

keytool -list -printcert -jarfile app.apk

输出将显示 APK 的 SignatureCertificate fingerprints (MD5, SHA1 and SHA256)Extensions

在为 android 创建客户端 ID 时将 SHA1 复制到 Signing-certificate fingerprint

【讨论】:

    猜你喜欢
    • 2017-09-06
    • 2022-11-04
    • 2014-03-27
    • 1970-01-01
    • 1970-01-01
    • 2015-02-20
    • 2016-03-02
    • 2017-03-09
    • 2020-01-10
    相关资源
    最近更新 更多