获得与客户端ID访问令牌时GoogleAuthException [英] GoogleAuthException when obtaining an access token with ClientID

查看:162
本文介绍了获得与客户端ID访问令牌时GoogleAuthException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有关更多的背景下,这个帖子如下<一个href=\"http://stackoverflow.com/questions/14218694/sso-with-google-account-on-both-website-and-mobile-app\">this 之一。

For more context, this post follows this one.

要解决我的previous问题,我试图按照由Tim布雷这里psented解决$ P $: Verifying后端从Android应用程序调用

To solve my previous problem, I tried to follow the solution presented here by Tim Bray: Verifying Back-End Calls from Android Apps

我宣布谷歌API的控制台两个项目拿到两客户ID

I declared two projects in Google APIs Console to get two Client IDs


  • 第一个为Web应用程序与localhost作为主机名(有什么关系?)

    • 客户端ID: XXXXXXXXXX.apps.googleusercontent.com

    • The first as "Web Application" with "localhost" as hostname (does it matter?)
      • Client ID: XXXXXXXXXX.apps.googleusercontent.com

      • 客户端ID: YYYYYYYYYY.apps.googleusercontent.com

      • Client ID: YYYYYYYYYY.apps.googleusercontent.com

      不幸的是,我面临的Andr​​oid端异常:

      Unfortunately I'm facing an exception in Android side:

      com.google.android.gms.auth.GoogleAuthException: Unknown
      at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source)
      at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source)
      at fr.barles.android.activity.LoginActivity$1.doInBackground(LoginActivity.java:66)
      at fr.barles.android.activity.LoginActivity$1.doInBackground(LoginActivity.java:1)
      at android.os.AsyncTask$2.call(AsyncTask.java:185)
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
      at java.util.concurrent.FutureTask.run(FutureTask.java:137)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
      at java.lang.Thread.run(Thread.java:1102)
      

      在该行:

      return GoogleAuthUtil.getToken(LoginActivity.this, account[0], "audience:server:client_id:XXXXXXXXXX.apps.googleusercontent.com");
      

      我在做什么错了?

      What I am doing wrong?

      在此先感谢

      推荐答案

      这两个客户端ID应该是同一项目的一部分。

      The two client IDs should be part of the same project.

      这篇关于获得与客户端ID访问令牌时GoogleAuthException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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