Firstly, to explain the situation:
- my app has been approved by App Review for
user_events
(screenshot below) - i am testing on the production app, with a real user account (testing with admin user returns false positives)
- calling
{user_id}/
works and returns the basic profile. - calling
{user_id}/permissions
works and returns the permissions (incuser_events
, screenshot below) - calling
{user_id}/events
always ‘works’ but returns and empty array.
I have tried testing with ‘me’ instead of the logged in fb_user_id and get the same empty data result. If I test from my own admin testing account, the user_events data is always populated with data. I have tried with less/no parameters than the screenshot below, all work fine for test users but not for live users.
Many thanks for any help!
screenshots:
2
Answers
Did you “sign in” your live user to your app, and after that choose this user to access to their token? Only after that, you can access the event of this user and etc. in case if that user gives permission for you.
1) You have to register in your app what kind of accessors your app will approve by Facebook for your app.
2) User has to be logged in to your app. (Choose token of your user in droplist like on the photo)
3) The user that is logged into your app must have open permission on their events, posts, etc.
Choose a user here
Testing with another user
My app is in development mode. You can also easily create and use testing users, customize them to your needs and log in to the account, or you can add a real facebook user to your account and assign him the tester role.
I log in with Ellison Clinton and create an event
I can retrieve via api the
/events
Then I switch the facebook app to production and delete the user from the test role
I can retrieve the user information
but I can not retrieve the previously created event
Completing the authorization process
Maybe you did not complete the review process for
user_events
?You can access the data in development, but not in production. I also did not complete the review process, but I can access the
user_events
data.You may need to perform the
Verification
also consider filing a bug and including the link here
How to debug Facebook Graphql
The only possible scenario is that the token you are using does not include the
user_events
permission.A request to
/users/events
with token missing theuser_events
permission will return status200
anddata: []
, no error messages in the response.I tested this scenario on the Graphql Facebook Explorer and the request does not return an error message. A debug message is displayed in the
Api explorer
, but it is not explicitly included in the response.I exported this request as curl and this is the result
You can retrieve the debug info passing the param
debug=all
in your/users/events
request as in thecurl
example below:My advice to you is to add the parameter
?debug=all
to your request and include the result of the response in your question, so that we can assist you troubleshooting.Below are the other test I performed with the
Graphql Facebook Explorer
and I was able to retrieve the events.STEP 1. Head over to Facebook Graph API Explorer
STEP 2. Generate a Token
get token -> get user access token
and add theuser_events
permissionSTEP 3. Run the queries
Use the endpoint
/me?fields=id,name
to retrieve your user-id and then:/{user-id}
/{user-id}/permission
/{user-id/events
as you can see from the pictures below,
/events
returnsdata: []
, while the/permissions
endpoint includes theuser_events
permission.My Facebook user did not join any event in the future. Creating an event and repeating the test returned some results.
The images below showcase my test cases