1

我可以使用以下代码通过 Jquery 中的 AJAX 调用检索配置文件信息:

var url = 'https://www.google.com/m8/feeds/profiles/domain/{DOMAIN_NAME}/full';
        $.ajax({
            url: url
                +'?access_token='
                +accessToken,
            headers: {
                'GData-Version': '3.0',
                'If-Match': '*'
            },
            async: false,
            dataType: 'text',
            success: function(data) {
                $('#result').text(data);
            }
        });
    };

但是,当我尝试使用相同的访问令牌检索图片时:

var url = 'https://www.google.com/m8/feeds/profiles/domain/{MY_DOMAIN}/full/{USER_NAME}';   
        $.ajax({
            url: url
                +'?access_token='
                +accessToken,
            headers: {
                'GData-Version': '3.0'
            },
            async: false,
            dataType: 'text',
            success: function(data) {
                $('#result').text(data);
            }
        });

我收到错误:401(令牌无效 - AuthSub 令牌的范围错误)

我使用的范围是配置文件数据 api 页面上提供的范围:https: //www.google.com/m8/feeds/profiles

如何获得正确的授权?提供的访问令牌是否不起作用?

4

2 回答 2

0

对于个人资料图片,我认为表单的 URL 应该是

https://www.google.com/m8/feeds/photos/profile/domainName/userName

这是文档: https ://developers.google.com/google-apps/profiles/#retrieving_photo

你会尝试一下,看看它是否有效?

于 2013-01-25T19:31:32.223 回答
0

尝试使用此路径作为范围

https://www.google.com/m8/feeds/

你可以参考这个帖子

于 2013-04-16T23:49:56.283 回答