是否可以使用oauth2检索Google地方信息的client_id?我能够检索包括ID和Google+个人资料网址在内的Google+信息,但是我需要一种将oauth2用户绑定到Google地方信息“ client_id”的方法。
我已经能够包含在oauth2弹出窗口中列出的Places范围,并询问用户是否有权访问资源,但无法弄清楚如何检索经过身份验证的用户的client_id。
范围:
var scopes = 'https://www.googleapis.com/auth/plus.me https://maps.google.com/maps/feeds/ https://www.googleapis.com/auth/places';
Google+ API加载
尽管我可以成功检索加号数据,但是places api似乎没有公开任何数据。这是我尝试过的:
function makeApiCall() {
/* the plus api does retrieve data, but a similar call to places does not
gapi.client.load('plus', 'v1', function () {
var request = gapi.client.plus.people.get({
'userId': 'me'
});
request.execute(function (resp) {
$(".google-signin").find("img").attr('src', resp.image.url).css('height', '32').css('width', '32');
$("#login-msg").text('Welcome: ' + resp.displayName);
$("img.vote").css('visibility', 'visible');
});
});
*/
gapi.client.load('places', 'v1', function () {
debugger
// the gapi.client does not contain a "places" object
var request = gapi.client.places.get({
'userId': 'me'
});
request.execute(function (resp) {
debugger
});
});
}
对此问题的任何澄清表示赞赏。
澄清编辑
也许我没有说清楚。 Google Places API鼓励创建与特定商家地点相关联的活动。我们正在根据Google Places API搜索和详细信息响应生成列表(位于top-60.bunkerhill.com的原型具有一个或多个链接)。我们希望企业能够将“事件”添加到其关联的列表中,但是如果没有这样做,则不允许这样做将Places Detail响应数据与Google Sign-On以某种方式相关联;还是我在这里错过了重要的事情?
因此,问题是“用户是否可以登录提供任何可用于将用户与“地方详情”条目相关联的数据的任何可用的Google OAuth API?
最佳答案
Google Places API与G + API不同。
检出https://developers.google.com/places/documentation/以获得访问Places数据的说明(请注意,您并未为此API使用OAuth-您只需在http请求中包含来自developers.google.com/console的密钥)。