8

Google OAuth api を使用して生年月日と婚姻状況を取得しようとしています。スコープを https://www.googleapis.com/auth/userinfo.profile & https://www.googleapis.com/auth/userinfo.emailとして設定することで、以下の情報を取得します。リクエスト URL はhttps://www.googleapis.com/oauth2/v2/userinfoです

{
 "id": "my_id",
 "email": "test@gmail.com",
 "verified_email": true,
 "name": "full_name",
 "given_name": "first_name",
 "family_name": "last_name",
 "link": "https://plus.google.com/xxxxxxx",
 "picture": "https://xxxxxxxxx/photo.jpg",
 "gender": "male",
 "locale": "en"
}

プロフィールに誕生日と婚姻状況を設定していますが、この情報を取得できません。問題は何でしょうか?

4

1 に答える 1

10

スコープを設定

https://www.googleapis.com/auth/plus.login

リクエストURLは

https://www.googleapis.com/plus/v1/people/me

注:-関係ステータスと誕生日は、ユーザーが公開に設定した場合にのみ利用できます。

このgoogle api explorerを見てください。

私はgrails oauthプラグインを使用してこれを試し、誕生日と関係のステータスを公開しました。

[birthday:1988-04-02, ..., relationshipStatus:single, ...]

編集................................................. ................................................

Q. New problem with email, I can't get it after changes

次のように複数のスコープを設定できます。

https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/plus.login

誕生日と交際ステータスを 1 つずつ、2 つのリクエストを作成します。

https://www.googleapis.com/plus/v1/people/me

もう1つはメール用

https://www.googleapis.com/oauth2/v2/userinfo
于 2013-10-27T12:08:03.013 に答える