0

I have successfully authenticedated to google using the scopes:

 var scopes=['email','profile','https://www.googleapis.com/auth/drive'];

I use this to try and read the user's email and profile:

function getEmail(resp)
{
  var email,isFound=false;
  console.log(resp);
  for(var i=0;i<resp.emails.length && !isFound;i++)
  {
    if(resp.emails[i].type==='account')
    {
        email=resp.emails[i].value;
        isFound=true
    }   
   }
   return email;    
 }

function getProfile(resp)
{
    console.log(resp);
    console.log("Retrieved profile for "+resp.displayName);
}

function handleResponse(resp)
{
    var email=getEmail(resp);
    var profile=getProfile(resp);
}

Inside handleAuthResult I call:

gapi.client.load('plus','v1',function(){
    //request profile information
    var request=gapi.client.plus.people.get({
        'userid':'me',
    });
    //execute the request
    request.execute(handleResponse);

});

Instead of the user's email and the profile,I get the following response:

{
"code": 403,
"message": "Access Not Configured. Please use Google Developers Console to activate the API for your project.",
"data": [
    {
        "domain": "usageLimits",
        "reason": "accessNotConfigured",
        "message": "Access Not Configured. Please use Google Developers Console to activate the API for your project."
    }
],
"error": {
    "code": 403,
    "message": "Access Not Configured. Please use Google Developers Console to activate the API for your project.",
    "data": [
        {
            "domain": "usageLimits",
            "reason": "accessNotConfigured",
            "message": "Access Not Configured. Please use Google Developers Console to activate the API for your project."
        }
    ]
}
}

I turned on the Google+ API in the Google API Console to get this:

{
"code": 404,
"message": "Not Found",
"data": [
    {
        "domain": "global",
        "reason": "notFound",
        "message": "Not Found"
    }
],
"error": {
    "code": 404,
    "message": "Not Found",
    "data": [
        {
            "domain": "global",
            "reason": "notFound",
            "message": "Not Found"
        }
    ]
}
}    
vamsiampolu
  • 6,328
  • 19
  • 82
  • 183

1 Answers1

0

The userid parameter is case-sensitive and should be userId instead.

I tested and using userid results in the 404 error message you are seeing while userId works for me. Not a very useful error message in this case...

Scarygami
  • 15,009
  • 2
  • 35
  • 24
  • @Scarygemi I get a 403 asking me to `Access Not Configured. Please use Google Developers Console to activate the API for your project.`I have the `Drive API`,the `Google+ API` and `Contacts API` active,what am i missing here – vamsiampolu Jul 27 '14 at 17:09