facebookfacebook-graph-apifacebook-oauth

Unable to get system user id from its access token on-behalf-of flow Meta/Facebook


I am trying to test out establishing on-behalf-of relationship between two businesses. Following the steps mentioned here https://developers.facebook.com/docs/marketing-api/business-manager/guides/on-behalf-of#steps

I am unable to get the system user id in step 3. I do get an access token in step 2. I can see it as valid in access token debugger, even see the app-scoped user id there with ads_management and public_profile permissions. But calling /me using that access token returns empty result. No id in response. Explicitly mentioned fields with id as well.

I would need this to call the next step of assigning this system user to an asset (ad account). If I use the ID from access token debugger, it works. But I would need a way to programatically get it with the token. Anything else I maybe missing?

Appreciate any pointers

Followed steps in recommendation on the link


Solution

  • But calling /me using that access token returns empty result

    Not sure why that would be the case; I'd expect an error message at least if something went wrong.

    But if you can get the ID from access token debugger tool, then you should also be able to get it, if you debug the token via API - https://developers.facebook.com/docs/facebook-login/guides/%20access-tokens/debugging