9

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 (inc user_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:

enter image description here

enter image description here

Haroldo
  • 36,607
  • 46
  • 127
  • 169

2 Answers2

2

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.

enter image description here

I log in with Ellison Clinton and create an event

enter image description here

I can retrieve via api the /events

enter image description here

Then I switch the facebook app to production and delete the user from the test role

enter image description here

I can retrieve the user information

enter image description here

but I can not retrieve the previously created event

enter image description here

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.

"If your app is in dev mode you should be able to get page access tokens with any permission for anybody who has a role on your app. If you just want to manage posts on your own page or the pages of users who have roles on your app, you'll be able to do so in development mode without submitting for app review." - Response from Facebook Developer Support

You may need to perform the

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 the user_events permission will return status 200 and data: [], 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.

enter image description here

I exported this request as curl and this is the result

~ $ curl -i -X GET  "https://graph.facebook.com/v3.3/10210855772523702/events?access_token=TOKEN"
HTTP/2 200 
content-type: application/json; charset=UTF-8
facebook-api-version: v3.3
x-fb-debug: h1WInt+yxtkm/1isTGfG2cd9JX8HAx5R5A9U/QC4k2lRrJ5mrKYaInR2Mm6XQ5UOrdSquAgWKnYj2jiTw6fwLQ==

{"data":[]}

You can retrieve the debug info passing the param debug=all in your /users/events request as in the curl example below:

~ $ curl -i -X GET  "https://graph.facebook.com/v3.3/10210855772523702/events?debug=all&access_token=TOKEN"
HTTP/2 200 
{"data":[],"__debug__":{"messages":[{"message":"The field 'events' is only accessible on the User object after the user grants the 'user_events' permission.","type":"warning"}]}}

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

enter image description here

STEP 2. Generate a Token

  1. get token -> get user access token and add the user_events permission

STEP 3. Run the queries

Use the endpoint /me?fields=id,name to retrieve your user-id and then:

  1. get /{user-id}
  2. get /{user-id}/permission
  3. get /{user-id/events

as you can see from the pictures below, /events returns data: [], while the /permissions endpoint includes the user_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

enter image description here

enter image description here

enter image description here

enter image description here

Fabrizio Bertoglio
  • 5,890
  • 4
  • 16
  • 57
  • thanks, @Haroldo . I updated my answer. I believe that the token you are using has no `user_events` permission. In this case, the request will return status `200` and `data: []`. No error message is included in the `response`. To verify this scenario you can test the request in the [facebook graph explorer](https://developers.facebook.com/tools/explorer) or [enable debug in your request](https://developers.facebook.com/docs/graph-api/using-graph-api/debugging) to provide us more info. I remain available to you. Thanks ! – Fabrizio Bertoglio May 03 '19 at 21:17
  • Thanks @Fabrizio - I have tried doing this with curl and debug all as suggested but the results are the same. Both my admin user and clean fb account return the desired /permissions for their respective access_tokens, but the clean account returns data=[] for /events (there are lots of events associated with this account) while the admin account returns a full data set. debug only gives me: __debug__":{"messages":[{"link":"https:\/\/developers.facebook.com\/docs\/apps\/versions\/","message":"No API version was specified. This request defaulted to version v2.9.","type":"warning"}]}} – Haroldo May 07 '19 at 15:02
  • @Haroldo I tested your full query and it works also with your parameters. Currently I have no idea why it does not work for you in production and I believe that [you should contact facebook, file a bug and share with us the information](https://developers.facebook.com/support/bugs/) so that we can better help you. Thanks and sorry – Fabrizio Bertoglio May 07 '19 at 16:41
  • does your code work for a user that is not a developer/tester of the app? – Haroldo May 08 '19 at 09:04
  • @Haroldo I updated my post as by you requested. STEP 1) I created a new user and added it as test user to the facebook.developers console, I can retrieve his events STEP 2) I moved to production my app, I updated my privacy policy and removed the user as test. I can not retrieve the events. Maybe you need to **Complete the authorization process** as explained in my post? Thanks. I don't think that the issue is related to the query itself, but your settings in the developers console restricting data usage – Fabrizio Bertoglio May 08 '19 at 10:45
  • @Haroldo thanks. I need the points. Can I further assist you? Fabrizio – Fabrizio Bertoglio May 11 '19 at 13:04
-3

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

Pavel
  • 31
  • 3