OAuth2登录后,Facebook获得个人资料链接 [英] Facebook get profile link after OAuth2 login
问题描述
我通过Facebook社交网络为网站上的用户使用OAuth2登录.
I use OAuth2 login through the Facebook social network for users on the website.
登录后是否仍然可以获取特定用户的Facebook个人资料URL(例如通过accessToken
),或者Facebook现在(在发生数据泄漏事件之后)隐藏此信息,并且不可能吗?
Is it still possible to get the certain user's Facebook profile URL after login(for example by accessToken
) or Facebook hides this information right now(after incidents with data leaks) and it is impossible?
推荐答案
是,如果用户授予许可.
It is, if the user grants permission.
您需要在登录时要求user_link
许可,然后您可以请求用户对象的link
字段-该字段将返回可在浏览器中使用的URL,以重定向到实际的配置文件.
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.
此URL包含某种形式的令牌,并且可能具有有限的有效性-因此,您不应存储这些令牌以供长期使用,而应在需要时请求新鲜的"令牌.
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
这篇关于OAuth2登录后,Facebook获得个人资料链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!