1

I am able to retrieve profile information via an AJAX call in Jquery using this code:

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);
            }
        });
    };

However when I try to retrieve a picture with the same access token:

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);
            }
        });

I get the error: 401 (Token invalid - AuthSub token has wrong scope)

The scope I'm using is the one provided on the profile data api page: https://www.google.com/m8/feeds/profiles

How do I get the correct authorization? Does the access token provided not do the job?

rog_perez
  • 11
  • 2
  • I'm stuck with similar problem, can't offer you a solution. But I think that you shouldn't use your access token in javascript, that's executed in a browser. – ckonig Feb 28 '13 at 20:16
  • @ckonig Did you find a solution to this problem? I am also stuck at the same point – Waqar Ahmad Apr 04 '13 at 04:25

2 Answers2

0

For profile pictures, I believe the URL of the form should be

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

Here is the documentation: https://developers.google.com/google-apps/profiles/#retrieving_photo

Would you try that and see if it works?

Emily
  • 1,464
  • 1
  • 9
  • 12
0

Try using this path as scope

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

You can refer this post

Community
  • 1
  • 1