PHP 的 fb_exchange_token 仅在用户删除应用程序后才起作用

发布于 2024-12-28 14:06:33 字数 887 浏览 1 评论 0原文

对于我正在构建的 Facebook 应用程序,我需要比默认 1 - 2 小时更长的时间。

我不想使用“offline_access”,因为它会阻止人们注册该应用程序,并且现在已被贬值。

在开发者路线图中,它谈到了“fb_exchange_token”,它将把访问令牌的到期日期延长至 1 个月。

流程为:

  • 登录用户

  • 调用 .../oauth/access_token?...&grant_type=fb_exchange_token&fb_exchange_token=...

  • 访问令牌现在是 1 个月长

这适用于所有对于新用户,以及从 Facebook 帐户中删除应用程序并重新添加的用户,但对于我们现有的客户群来说,它不起作用。

我尝试了各种方法,包括向登录脚本添加其他权限以强制验证窗口,但没有运气。

我已按照文档中的说明为 Facebook 应用程序添加了正确的高级/迁移设置。除了开发博客之外,似乎对此没有太多帮助。

任何帮助将不胜感激。

仅供参考:我正在使用最新的 PHP SDK,获取新访问令牌的代码只是指向以下 url 的标准 cURL 请求:

https://graph.facebook.com/oauth/access_token?client_id={APPID}&client_secret={APPSECRET}&grant_type=fb_exchange_token&fb_exchange_token={ACCESSTOKEN}

再次感谢

For a Facebook app that I am building, I require longer time than the default 1 - 2 hours.

I don't want to use "offline_access" as it puts people off from signing up to the app and is now depreciated.

In the developer road map it talks about "fb_exchange_token" which will extend the access token expiry date to 1 month.

The flow is:

  • Login User

  • Call .../oauth/access_token?...&grant_type=fb_exchange_token&fb_exchange_token=...

  • Access token is now 1 month long

This works fine for all the new users, and for users who delete the app from their Facebook account and re-add it, but for our existing customer base, it doesn't work.

I have tried all sorts including adding other permissions to the login script to force the authenticate window, but no luck.

I have added the correct advanced/migration setting for the Facebook app as described in the documentation. There doesn't appear to be much help on this, apart from the dev blog.

Any help will be greatly appreciated.

FYI: I'm using the most up-to-date PHP SDK and the code to get the new access token is just the standard cURL request pointing to the following url:

https://graph.facebook.com/oauth/access_token?client_id={APPID}&client_secret={APPSECRET}&grant_type=fb_exchange_token&fb_exchange_token={ACCESSTOKEN}

Thanks again

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

又怨 2025-01-04 14:06:33

我有同样的问题。我注意到的另一件事是:之前拥有离线访问权限的用户以及新授权的用户也可以获得 60 天的令牌。

我打开了一个错误,试图从 FB 获得响应:https://developers.facebook.com/bugs/ 241373692605971

I am having the same issue. One other thing I've noticed: users that previously had the offline_access permission are also able to get the 60 day tokens, as well as newly authorized users.

I opened a bug to try to get a response from FB: https://developers.facebook.com/bugs/241373692605971

一个人的夜不怕黑 2025-01-04 14:06:33

我一直面临这个问题,发现刚才对我有用的是从我的个人资料中删除该应用程序并重新添加该应用程序,这使我能够生成 60 天的令牌。

I have been facing this problem and found that what just worked just now for me was deleting the app from my profile and re-adding the app and that allowed me to generate a 60 day token.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文