1
我使用OAuth2進行了Google登錄。沒有通過Google登錄獲取用戶數據
我使用的範圍是userinfo。但是我只能從對象返回中得到id。
我應該得到的東西是這樣的:
{
"id": "<some-id>,
"email": "<correct-email-id>",
"verified_email": true,
"name": "blabla",
"given_name": "blabla",
"family_name": "blabla",
"link": "<link>",
"gender": "male",
"locale": "en"
}
但我只得到:
{
"id": "<some-id>
}
我已經試過:
https://www.googleapis.com/oauth2/v1/userinfo?access_token=<access-token>
https://www.googleapis.com/oauth2/v2/userinfo?access_token=<access-token>
,這是呼叫:
$.ajax({
type: 'GET',
url: 'https://www.googleapis.com/oauth2/v1/userinfo?access_token=' + accesstoken,
async: false,
contentType: 'json',
success: function(result) {
profileemail = result.email;
console.log(result);
},
error: function(e) {
console.log(e);
}
});
您可以指定所用範圍的完整字符串嗎? – mariuss