Android应用程序中的Google Plus密钥:什么密钥?
我正在开发一个Android应用程序,我需要检索用户配置文件图片。我已经使用OAuth获取令牌,如下所述: 任何,我无法正确检索用户的信息。我试过这个:Android应用程序中的Google Plus密钥:什么密钥?,android,google-plus,Android,Google Plus,我正在开发一个Android应用程序,我需要检索用户配置文件图片。我已经使用OAuth获取令牌,如下所述: 任何,我无法正确检索用户的信息。我试过这个: https://www.googleapis.com/plus/v1/people/me?key={YOUR_API_KEY} 但我无法理解关键是什么:在我的谷歌控制台上,我有: web应用程序的客户端ID Android应用程序的客户端ID 服务器应用程序的密钥 Android应用程序的密钥 哪一个是正确的钥匙?我有点困惑。检索令牌并在
https://www.googleapis.com/plus/v1/people/me?key={YOUR_API_KEY}
但我无法理解关键是什么:在我的谷歌控制台上,我有:
- web应用程序的客户端ID
- Android应用程序的客户端ID
- 服务器应用程序的密钥
- Android应用程序的密钥
https://www.googleapis.com/plus/v1/people/me?key={YOUR_API_KEY}
我总是收到401400或403的电话,上面写着:
- “未配置访问权限。请使用Google开发者控制台激活项目的API。”
- 错误的重新请求集
- “无效凭据”
{
"kind": "plus#person",
"etag": "\"7zDxHg5s5mqDKJRPJZIoOsdfecE/hQCtSSux92KyaIK9CGzq7XZppYY\"",
"urls": [
{
"value": "http://www.osijek360.com",
"type": "website",
"label": "www.osijek360.com"
},
{
"value": "https://plus.google.com/+Osijek360/about",
"type": "other",
"label": "OSIJEK360 (page)"
},
{
"value": "https://www.facebook.com/OSIJEK360",
"type": "other",
"label": "OSIJEK360 (fan page)"
},
{
"value": "http://www.webonjee.com",
"type": "other",
"label": "------------------------------------\u003e www.webonjee.com"
},
{
"value": "https://www.facebook.com/webonjee.osijek",
"type": "other",
"label": "Webonjee Osijek (profile)"
},
{
"value": "https://www.facebook.com/WEBONJEE",
"type": "other",
"label": "WEBONJEE™ (page)"
},
{
"value": "https://www.twitter.com/WEBONJEE",
"type": "other",
"label": "WEBONJEE™ (profile)"
},
{
"value": "http://www.linkedin.com/in/webonjee",
"type": "other",
"label": "WEBONJEE™ (profile)"
}
],
"objectType": "page",
"id": "115657794332822874007",
"displayName": "OSIJEK360",
"tagline": "Osječki web portal sa 3D – 360º virtualnim šetnjama i panoramama",
...
}
/我的请求
正确配置后,您还需要提供访问\u令牌
,以便能够使用/me
请求,如下所述:
如果使用userId值“me”,则此方法需要身份验证
使用已被授予OAuth作用域的令牌
或
. 阅读更多关于OAuth的信息
是的,但在本例中,我使用的是GoogleApis,无法通过HttpGet获取信息?您需要服务的API密钥以允许将数据返回给您。这就是谷歌控制谁访问特定数据的方式。好的,谢谢,现在一切都清楚了。无论如何,我已经尝试在Android中使用Google+API和GoogleAuthUtil来获取令牌,它正在工作。无论如何,如果我跳过浏览器()上的链接,结果仍然是401个无效凭据。也许通过网络浏览器是不可能的?我已经添加了更多的细节。TL;DR:您需要提供一个
access\u令牌
@edoardotogoni您是否使用access\u令牌
尝试了请求?嘿@edoardotogoni,我已经提交了一份关于此的错误报告,因为在凭据区域创建的Android或iOS密钥实际上都不适用于API调用。如果可能的话,你能把它放在那里,这样它就可以得到适当的注意,或者得到修复吗?网址:
{
"kind": "plus#person",
"etag": "\"7zDxHg5s5mqDKJRPJZIoOsdfecE/hQCtSSux92KyaIK9CGzq7XZppYY\"",
"urls": [
{
"value": "http://www.osijek360.com",
"type": "website",
"label": "www.osijek360.com"
},
{
"value": "https://plus.google.com/+Osijek360/about",
"type": "other",
"label": "OSIJEK360 (page)"
},
{
"value": "https://www.facebook.com/OSIJEK360",
"type": "other",
"label": "OSIJEK360 (fan page)"
},
{
"value": "http://www.webonjee.com",
"type": "other",
"label": "------------------------------------\u003e www.webonjee.com"
},
{
"value": "https://www.facebook.com/webonjee.osijek",
"type": "other",
"label": "Webonjee Osijek (profile)"
},
{
"value": "https://www.facebook.com/WEBONJEE",
"type": "other",
"label": "WEBONJEE™ (page)"
},
{
"value": "https://www.twitter.com/WEBONJEE",
"type": "other",
"label": "WEBONJEE™ (profile)"
},
{
"value": "http://www.linkedin.com/in/webonjee",
"type": "other",
"label": "WEBONJEE™ (profile)"
}
],
"objectType": "page",
"id": "115657794332822874007",
"displayName": "OSIJEK360",
"tagline": "Osječki web portal sa 3D – 360º virtualnim šetnjama i panoramama",
...
}