Python中文
首页
教程
问答
标签
搜索
登录
注册
GLS错误:google云终结点中的无效受众
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p>我正在尝试让一个google端点工作,我创建了一个端点服务,并能够通过google API exploer测试它的工作是否正常。然后我生成了android客户端并尝试调用我的端点服务。我在日志中看到这个错误</p> <pre><code>04-05 08:48:20.547: I/GLSUser(13505): GLS error: INVALID_AUDIENCE myemail@gmail.com audience:server:client_id:334082396285-hfn3t2g5pg0gv8fshf22kaadq9fs23e2.apps.googleusercontent.com </code></pre> <p>这是我的android java代码来构建凭证,即用来访问我的服务</p> <pre><code>AUDIENCE = "server:client_id:334082396285-hfn3t2g5pg0gv8fshf22kaadq9fs23e2.apps.googleusercontent.com"; credential = GoogleAccountCredential.usingAudience(this, AUDIENCE); setAccountName(settings.getString(PREF_ACCOUNT_NAME, null)); </code></pre> <p>客户id好像有点不匹配。这是我做的</p> <p>1)在一个API项目的Google API控制台中创建了2个客户端ID, a) WEB_CLIENT_ID=I为重定向uri=None&JavaScript origins=None的WEB应用程序创建了一个CLIENT_ID。 b) ANDROID_CLIENT_ID=使用包名和sha1证书指纹为ANDROID应用程序创建了一个CLIENT_ID。</p> <p>2)然后在我的python端点服务中使用它们</p> <pre><code>@endpoints.api(name='devices', version='v1', description='Service to register devices', allowed_client_ids=[ANDROID_CLIENT_ID,WEB_CLIENT_ID,endpoints.API_EXPLORER_CLIENT_ID], audiences = [WEB_CLIENT_ID]) </code></pre> <p><strong>完成日志</strong></p> <pre><code>04-05 08:48:20.397: D/overlay(159): Set pipe=RGB1 dpy=0; Set pipe=VG0 dpy=0; 04-05 08:48:20.547: W/GLSUser(13505): Status from wire: INVALID_AUDIENCE status: null 04-05 08:48:20.547: W/GLSUser(13505): Status from wire: INVALID_AUDIENCE status: null 04-05 08:48:20.547: I/GLSUser(13505): GLS error: INVALID_AUDIENCE myemail@gmail.com audience:server:client_id:334082396285-hfn3t2g5pg0gv8fshf22kaadq9fs23e2.apps.googleusercontent.com 04-05 08:48:20.547: W/GLSUser(13505): Status from wire: Unknown status: UNKNOWN 04-05 08:48:20.547: W/System.err(31908): com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAuthIOException 04-05 08:48:20.547: W/System.err(31908): at com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential$RequestHandler.intercept(GoogleAccountCredential.java:224) 04-05 08:48:20.547: W/System.err(31908): at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:836) 04-05 08:48:20.547: W/System.err(31908): at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:412) 04-05 08:48:20.557: W/System.err(31908): at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:345) 04-05 08:48:20.557: W/System.err(31908): at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:463) 04-05 08:48:20.557: W/System.err(31908): at com.package.appname.SetupActivity$SendResultToServerTask.doInBackground(SetupActivity.java:174) 04-05 08:48:20.557: W/System.err(31908): at com.package.appname.SetupActivity$SendResultToServerTask.doInBackground(SetupActivity.java:1) 04-05 08:48:20.557: W/System.err(31908): at android.os.AsyncTask$2.call(AsyncTask.java:287) 04-05 08:48:20.557: W/System.err(31908): at java.util.concurrent.FutureTask.run(FutureTask.java:234) 04-05 08:48:20.557: W/System.err(31908): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) 04-05 08:48:20.557: W/System.err(31908): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 04-05 08:48:20.557: W/System.err(31908): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 04-05 08:48:20.557: W/System.err(31908): at java.lang.Thread.run(Thread.java:856) 04-05 08:48:20.557: W/System.err(31908): Caused by: com.google.android.gms.auth.GoogleAuthException: Unknown 04-05 08:48:20.557: W/System.err(31908): at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source) 04-05 08:48:20.557: W/System.err(31908): at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source) </code></pre> <p>已经看到了类似的线索,但没有帮助, <a href="https://stackoverflow.com/questions/15031238/google-api-and-android-oauth-invalid-audience-error">Google Api and android Oauth INVALID_AUDIENCE error</a></p>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>我在google api控制台中设置项目的名称来解决这个问题。</p> <p>在[APIs&;auth]-->;[同意屏幕]中的新UI API控制台中</p>
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
尝试将单元格与pythondocx合并
3 回答
尝试将卡的5个值传递给函数,但不起作用
4 回答
尝试将卷绑定到docker容器
10 回答
尝试将原始queryset转换为queryset时出错
4 回答
尝试将原始输入与函数一起使用
7 回答
尝试将参数传递给函数时,可以通过python中的“@app.route”
2 回答
尝试将变量mid脚本返回到我的模板
3 回答
尝试将变量从一个函数调用到另一个函数
1 回答
尝试将变量传递给一个名称与参数不同的函数是否更好?
1 回答
尝试将变量传递给函数内部的函数。Python
9 回答
尝试将变量作为参数传递
10 回答
尝试将变量作为命令
3 回答
尝试将变量旁边的数据从文本复制到csv时,python获取错误:
9 回答
尝试将变量输入到sql数据库中已创建的行中
4 回答
尝试将只有两个或更多重复元音的单词打印到文本文件中
5 回答
尝试将后缀(字符串)添加到列表中每个WebElement的末尾
9 回答
尝试将命令行输出保存到fi时出错
8 回答
尝试将唯一ASCII文件导入数据帧时出现分析错误
2 回答
尝试将回归程序从stata转换为python
4 回答
尝试将图像上的点投影到二维平面时打开CV通道
2 回答