Getting ids_for_pages from Graph returns empty

…衆ロ難τιáo~ 提交于 2020-03-03 07:58:27

问题


I'm having some trouble connecting people across apps and bots in messenger.

https://developers.facebook.com/docs/messenger-platform/connecting-accounts

I've already associated my developers facebook app (with a Facebook log in and Messenger Products) in Business, as well as the page.

My objective is in my server being able to identify the messenger user with the log in user in the app. So when the user would go to the messenger would have the same experience as in the app.

The trouble is: when I try to get ids_for_pages from graph it returns the data empty, even after this user talks to the bot.

Graph GET (v2.10)

/{user_login_id}/ids_for_pages?access_token={user_login_access_token}&appsecret_proof={appsecret_proof}

{"data": []}

When I'm using the Page-Scoped ID I'm able to get ids_for_apps (great I can use that to match the user if the user already log in to my app), but if the user talks to the bot and then goes to my app I see no way for me to match the user. I also investigated on Business Mapping API with the token_for_business but it is necessary the user node. Great in the app but I can't get the user token or user node by the Page-Scoped ID.

https://developers.facebook.com/docs/apps/for-business

Am I doing something wrong? A missing permission? My bot is live and has pages_messaging.

Any guidance helps! Thank you for your time!

EDIT

As amuramoto said, I was using the wrong access_token. It must be the same as I used in the ids_for_apps.

/{user_login_id}/ids_for_pages?access_token={page_access_token}&appsecret_proof={appsecret_proof}

回答1:


Putting this here in case this questions comes up for anyone in the future.

You aren't using the right access token. The example in the docs show that calls to ids_for_pages requires a page-scoped access token, not the user access token.



来源:https://stackoverflow.com/questions/45371955/getting-ids-for-pages-from-graph-returns-empty

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!