You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

求助:使用Facebook OpenGraph API获取用户任职信息失败

Troubleshooting: Unable to Fetch User Work/Company Data via Facebook Graph API

Hey there, let's work through why your work field request is only returning the user ID instead of the job or company info you're targeting. Here are the key fixes to try out:

1. You're Missing the Required Permission

The work field can't be accessed with a basic access token—it requires the user_work_history permission. Here's how to add it in the OpenGraph Explorer:

  • Click the "Get Token" dropdown in the top-right corner.
  • Select "Get User Access Token".
  • In the permission list, find and check the user_work_history box.
  • Click "Get Access Token" and follow the prompts to authorize this permission for your test account.

Once you have the updated token, re-run your request—you should see work data if it exists on the user's profile.

2. Request Specific Nested Fields

The work field returns an array of objects with nested details (like employer name, position title, etc.). If you only request work, you might get truncated data, or just the user ID if permissions are still missing. Try specifying the exact subfields you need with this request:

{user-id}?fields=work{employer{name},position{name},start_date,end_date}

This will directly pull the company name (employer.name) and job title (position.name) along with optional start/end dates.

3. Check the User's Privacy Settings

Even with the right permissions, if the user's work history is set to a strict privacy level (e.g., "Only Me"), your app won't be able to access it. Ask your test user to:

  • Go to their Facebook profile, edit their work experience entry.
  • Adjust the privacy setting for that entry to allow access from your app (or set it to "Friends" / "Public" for testing purposes).

4. Use the Latest Stable API Version

Older API versions might have deprecated or changed how the work field is accessed. In the Explorer's top bar, select the newest stable API version (e.g., v18.0) before running your request to avoid compatibility issues.

Bonus Note for Public Apps

If you're building an app for non-test users, the user_work_history permission requires Facebook's app review. You'll need to submit your app for review and explain why you need access to this data before it can be used with regular users.

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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 03:28:13