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"
}
]
}
}