谷歌阿比和Android的Oauth INVALID_AUDIENCE错误阿比、错误、Oauth、Android

2023-09-06 02:15:50 作者:寒风笑雪夜

我得到一个 GoogleAuthException:未知的错误,虽然做了 GoogleAuthUtil.getToken

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

我从释放键,包名,到了谷歌API项目设置SHA1。 (其中的方式被成功地用于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. )

推荐答案

看起来应该工作;这里是从我的应用程序的范围,初始化code这不工作。

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

您必须有两个客户端ID项目 一个是适合您的Andr​​oid应用程序,与SHA和放大器;包装及放大器;等等 另一种是在服务器端,你要发送的令牌关闭以

这是一个从#3变后的客户端ID ...:CLIENT_ID:

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