Retrieving date of birth and marital status with Google OAuth API

前端 未结 1 1255
南笙
南笙 2020-12-06 12:32

I\'m trying to retrieve date of birth and marital status via Google OAuth api. I get below mentioned info by setting the scopes as https://www.googleapis.com/auth/userinfo.

相关标签:
1条回答
  • 2020-12-06 13:20

    Set scope to

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

    and request url is

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

    NOTE:- Relationship Status and Birthday only available to you if user set them public.

    Have a look to this google api explorer.

    I have tried this using grails oauth plugin and make my birthday and relationship status public it gives me

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

    EDIT.................................................................................

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

    You can set multiple scopes like:

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

    and make two requests one for birthday and relationship status

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

    and another for email

    https://www.googleapis.com/oauth2/v2/userinfo
    
    0 讨论(0)
提交回复
热议问题