Google Api 和 android Oauth INVALID_AUDIENCE 错误 [英] Google Api and android Oauth INVALID_AUDIENCE error

查看:26
本文介绍了Google Api 和 android Oauth INVALID_AUDIENCE 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在执行 GoogleAuthUtil.getToken 时收到 GoogleAuthException: Unknown error.

I am getting a GoogleAuthException: Unknown error, while doing a GoogleAuthUtil.getToken.

就在我看到异常之前

GLSUser: GLS error: INVALID_AUDIENCE <email> audience:server:client_id:xxx.apps.googleusercontent.com

我已将我的发布密钥(包名称)中的 SHA1 设置为 google api 项目.(顺便说一下,它已成功用于 GCM.)

I have set the SHA1 from my release key , the package name, to the google api project. (Which by the way is being used successfully for GCM. )

推荐答案

看起来应该可行;这是我的应用中的 scope-in​​it 代码,它确实有效.

Looks like that should work; here's the scope-init code from my app which does work.

private static final String SCOPE = "audience:server:client_id:" + SERVER_CLIENT_ID;

所以我觉得客户端 ID 有问题.记住这一点

So it smells to me like there's a problem with the client id. Remember that

  1. 你必须有一个有两个客户端 ID 的项目
  2. 一个适用于您的 Android 应用,带有 SHA &包&等等
  3. 另一个用于您要将令牌发送到的服务器端

#3 中的客户端 ID 位于 ...:client_id:

It's the client ID from #3 that goes after ...:client_id:

这篇关于Google Api 和 android Oauth INVALID_AUDIENCE 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆