Reputation: 1
I'm developing an app that will make use of the Business On Behalf Of API (https://developers.facebook.com/docs/marketing-api/business-manager/guides/on-behalf-of#bm-client). Based on the steps in the documentation above, I was able to progress with regards to login (step 0), creation of the partnership between the BMs (step 1), generation of the access token for the client's BM system user (step 2) and I am stuck in obtaining the system user identification number (step 3) through the following request:
curl -i -X GET
"https://graph.facebook.com/v19.0/me?access_token=<CLIENT_BM_SU_ACCESS_TOKEN>"
I have a valid system user token, with all desired permissions and attributes, validated through the Access Token Debugger (https://developers.facebook.com/tools/debug/accesstoken/?access_token=...&version=v19. 0). However, the request to get this user's id continues to return an empty json as a response.
Request made: curl --location 'https://graph.facebook.com/v19.0/me?fields=id&access_token=...'.
The response is always {} (empty json).
My app's permissions at login are: pages_read_engagement business_management ads_management
The system user access token created in the customer's BM has the following permissions: ads_management pages_read_engagement
as the documentation suggests (I've already tested generating this token with other permissions, but the problem persists).
I tried to research whether it was a lack of permissions, but I couldn't find anything conclusive. I researched the app's settings and didn't get promising results either. I tested using both Login and Login for Business as a Product for my app, but there was no difference in relation to the problem. Making this same request with user or system user tokens, administrators or not, from my accounts and my BM works as expected (returns the user id), but when it is a system user of the client's BM, following the step the step of the Business Intermediation documentation, it doesn't work.
I need this id to assign the assets to this user and then have access to the client's pages. By manually obtaining the user ID through the debugger and following the other steps, it is possible to complete the entire process and carry out the intermediation as expected (manage the assets on behalf of another company). However, this step is not allowing me to automate the process 100% and will hinder the usability of my application. Am I missing something?
Upvotes: 0
Views: 512
Reputation: 97
Use a permission "public_profile" while generating an access token.
Upvotes: 0