“无法创建与服务器的可靠连接"使用 google plus 登录时出错 [英] "Can't create reliable connection to server" error while signin using google plus
问题描述
我正在开发一个应用程序,我想在其中使用 google plus 登录.我已按照以下步骤操作https://developers.google.com/+/mobile/android/sign-in
I am developing an application in which i want sign in using google plus. I have follow the steps from https://developers.google.com/+/mobile/android/sign-in
但是当我尝试使用 google api 示例项目(从 android sdk->extras->google services 导入)登录 google plus 时它总是显示无法创建与服务器的可靠连接".
But when i try to sign in to google plus using google api sample projects(imported from android sdk->extras->google services) it always show "Can't create reliable connection to server".
我该如何解决?我正在真实设备上测试样本.
How can i solve it? i am testing the sample on real device.
我的logcat如下,
My logcat is as follows,
05-17 15:21:56.500: E/GLSUser(6721): Empty consent data
05-17 15:21:56.500: I/GLSUser(6721): GLS error: NetworkError testid.android@gmail.com oauth2:https://www.googleapis.com/auth/plus.login
05-17 15:21:56.500: W/GLSUser(6721): Status from wire: NetworkError status: NETWORK_ERROR
推荐答案
当遵循 https://developers.google.com/+/mobile/android/sign-in,我也收到了空同意数据".
When following the code example at https://developers.google.com/+/mobile/android/sign-in, I got "Empty consent data" as well.
但是在 PlusClient
实例上调用 setScopes()
似乎可以解决问题:
But calling setScopes()
on the PlusClient
instance seemed to solve the problem:
mPlusClient = new PlusClient.Builder(this, this, this)
.setVisibleActivities("http://schemas.google.com/AddActivity")
.setScopes(Scopes.PLUS_LOGIN, Scopes.PLUS_PROFILE)
.build();
您是否在代码示例中设置了范围?
Have you set scopes in your code example?
这篇关于“无法创建与服务器的可靠连接"使用 google plus 登录时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!