Facebook get profile link after OAuth2 login

前端 未结 1 959
無奈伤痛
無奈伤痛 2021-01-26 21:19

I use OAuth2 login through the Facebook social network for users on the website.

Is it still possible to get the certain user\'s Facebook profile URL after login(for ex

1条回答
  •  旧时难觅i
    2021-01-26 21:31

    It is, if the user grants permission.

    You need to ask for user_link permission on login, and then you can request the link field of the user object – that will return a URL that can be used in a browser, to redirect to the actual profile.

    This URL contains some form of token, and likely has limited validity - so you should not store those for long-term use, but rather request a “fresh” one when it is needed.

    https://developers.facebook.com/docs/facebook-login/permissions#reference-user_link

    0 讨论(0)
提交回复
热议问题