You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

2020版:网站通过Facebook获取用户个人主页链接方案咨询

Yes, you absolutely can request users to connect their Facebook account and retrieve their personal profile link (in the format http://facebook.com/{profile}), but you need to follow Meta's current permission rules closely—these have tightened significantly in recent years, so old methods might no longer work.

Feasibility & Core Rules

First, Meta allows access to a user's profile link, but you must have a clear, legitimate use case (e.g., verifying user identity, enabling social sharing, or personalizing their experience on your site). You’ll need to explicitly state this use case during your app’s review process; vague or unnecessary requests will get your app denied access to the required permissions.

The only supported, up-to-date way to get a user’s Facebook profile link is via Meta’s Graph API (use the latest stable version, e.g., v18.0 as of now). Here’s the step-by-step process:

  1. Integrate Facebook Login on Your Website
    Use Meta’s official Facebook Login SDK for web, or implement the OAuth 2.0 flow manually. This is the foundation for authenticating users and requesting permissions.

  2. Request the user_link Permission
    When initiating the login flow, explicitly ask for the user_link permission (alongside the basic public_profile permission if needed). This permission is required to access the user’s profile link—note that public_profile alone no longer guarantees access to this field for all users due to privacy changes.

    Important: You must justify why you need user_link during app review. Be specific about how you’ll use the link (e.g., "We use the profile link to let users share their activity on our site directly to their Facebook profile").

  3. Fetch the Profile Link via Graph API
    Once the user has authorized your app, call the /me endpoint with the fields=link parameter. Example API call (using a valid user access token):

    GET /v18.0/me?fields=link&access_token={USER_ACCESS_TOKEN}
    

    The response will include the user’s full profile link (e.g., https://www.facebook.com/john.doe.123 or a custom username-based link if the user has set one).

Critical Notes

  • Avoid Workarounds: Don’t try to scrape or construct the link using username fields (e.g., /me?fields=username then building the URL manually). Many users have hidden their username or don’t have one, and this method violates Meta’s terms of service.
  • Privacy Compliance: Even with permission, you can’t use the profile link for unsolicited messaging or any purpose not disclosed during review. Ensure you follow Meta’s Data Use Policy and all applicable privacy laws (like GDPR).
  • App Review is Mandatory: You can’t use user_link in production without passing Meta’s app review. Test with sandbox users first during development.

内容的提问来源于stack exchange,提问作者Kjensen

火山引擎 最新活动