【发布时间】:2013-01-12 01:23:51
【问题描述】:
是否可以使用 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 加载
虽然我可以成功检索plus数据,但是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 search 和 details 响应生成列表(top-60.bunkerhill.com 的原型跟随一个或多个链接)我们希望企业能够将事件添加到它们的关联列表中,但如果不首先以某种方式将 Places Detail 响应数据与 Google Sign-On 相关联,则不允许这样做;还是我在这里遗漏了一些重要的东西?
所以问题是“用户是否可以登录到任何可用的 Google OAuth API,该 API 提供了一些可用于将用户与 Places Details 条目相关联的数据?
【问题讨论】:
标签: javascript google-maps-api-3 oauth-2.0 google-plus google-places-api