尝试通过Google+登录按钮进行身份验证的INVALID_KEY消息

时间:2013-05-24 11:39:26

标签: android google-plus google-play-services

我正在尝试在this gist by Ian Barber之后对用户进行身份验证。该按钮要求输入用户帐户,但它永远不会显示授权对话框,而是退出并显示消息“内部错误发生”。 Logcat显示了这个:

W/GLSUser ( 4353): Status from wire: INVALID_KEY status: null
W/GLSUser ( 4353): Status from wire: INVALID_KEY status: null
E/GLSUser ( 4353): Empty consent data
I/GLSUser ( 4353): GLS error: INVALID_KEY icoloma@gmail.com oauth2:https://www.googleapis.com/auth/plus.login
W/GLSUser ( 4353): Status from wire: Unknown status: UNKNOWN

用于签署我的应用的证书与我的Google API控制台页面配置的证书相同,且包名也相同。

4 个答案:

答案 0 :(得分:18)

当您在“简单API访问”部分中添加证书而不是“已安装应用程序的客户端ID”时,会发生这种情况。在项目的Google API console中,单击“创建OAUTH2客户端ID”(不是“创建新的Android密钥”),选择“Android”并介绍您的SHA1和包。

答案 1 :(得分:1)

我遇到了类似的错误:

772-799/com.google.process.gapps W/GLSUser﹕ GoogleAccountDataService.getToken()
05-21 13:23:50.231      772-799/com.google.process.gapps W/GLSActivity﹕ [art] Status from wire: INVALID_KEY status: null
05-21 13:23:50.231      772-799/com.google.process.gapps W/GLSActivity﹕ [art] Status from wire: INVALID_KEY status: null
05-21 13:23:50.235      772-799/com.google.process.gapps I/GLSUser﹕ GLS error: INVALID_KEY my-gmail@address.com oauth2:https://www.googleapis.com/auth/plus.login
05-21 13:23:50.235      772-799/com.google.process.gapps W/GLSActivity﹕ [art] Status from wire: Unknown status: UNKNOWN

我通过使用我生成的密钥库对APK进行签名来修复它。密钥库SHA已添加到我们的Google Developer控制台中。

答案 2 :(得分:0)

发生此错误的另一个原因是:

如果您有子包,请确保您只在开发人员的控制台中提及应用程序的主包,而不是子包。

例如:如果您的应用位于com.example.myapp下,如果您的G +登录活动位于包com.example.myapp.authentication下,则在开发人员的控制台中,您输入的包名称应为 com.example.myapp (省略子包装)

答案 3 :(得分:0)

在我的情况下,这个错误发生可能是,因为我使用sha256withrsa算法来签署我的APK而不是sha1withrsa。可能 - 我不确定,因为我不会因为Google API愚蠢而改变我的签名密钥。

相关问题