【问题标题】:Oauth 2.0 : Accessing asset in google map engineOauth 2.0:在谷歌地图引擎中访问资产
【发布时间】:2014-07-25 16:59:44
【问题描述】:

我尝试调用 Ajax GET 方法来访问资产 - 我创建的谷歌地图引擎资产,给定资产 ID。

$.ajax({
        cache: false,
        url: 'https://www.googleapis.com/mapsengine/v1/assets/0773289246413284785416071188762309719429',
        type: 'GET',
        async: false,
        success: function(result){
            console.log(result);
        }
    });

但这不起作用,并且出现错误:

GET https://www.googleapis.com/mapsengine/v1/assets/07732892464132847854-16071188762309719429?_=1406257065386 401 (Unauthorized) 

说它是未经授权的。当我执行时,我尝试使用资产 ID 在 google Asset 中测试 GET 资产。它说:

This method requires you to be authenticated. You may need to activate the toggle above to authorize your request using OAuth 2.0.

我可以在那里测试 GET 资产,方法是在那里提供 OAuth。但是我如何在我的应用程序中做到这一点?如何提供 OAuth 2.0 身份验证以便我可以访问资产?谢谢!

【问题讨论】:

    标签: google-maps google-app-engine oauth oauth-2.0 google-oauth


    【解决方案1】:

    您需要的是 OAuth2 授权。首先你需要得到一个 oauth 令牌,然后把它放到你的 reuest 中。

    Here is a guide for your reference。我认为该指南很详细,并且包含示例代码,因此请遵循它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-05-22
      • 2013-10-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多