简体   繁体   English

拨打facebook api wthout offline_access令牌

[英]Call facebook api wthout offline_access token

I have a problem in using facebook api. 我在使用facebook api时遇到问题。

My customer makes my facebook user admisistrator of his facebook product page. 我的客户让我的Facebook用户成为他的facebook产品页面的管理员。

I use a java engine which is scheduled for retriving this page insight data. 我使用了一个java引擎,它被安排用于检索此页面洞察数据。 As it is a java angine, ther is no "human" user who can perform some actions (a login for example). 因为它是一个java angine,所以不是可以执行某些操作的“人类”用户(例如登录)。

For this reason I used an offline_access token so i could retrive data, for example, in this way: 出于这个原因,我使用了一个offline_access令牌,所以我可以以这种方式检索数据:

https://graph.facebook.com/MY_PAGE_ID/insights/page_fans/lifetime?format=json&access_token=MY_OFFLINE_ACCESS_TOKEN.

This works ok but... ... offline_access is now deprecated and I want to change my code to obtain access token in the right way. 这工作正常,但是...... offline_access现已弃用 ,我想更改我的代码以正确的方式获取访问令牌。 It seems there is no way to autenticate my user programmatically and obtain an acces token which gives me the possibility to perform the above insight data request. 似乎没有办法以编程方式对我的用户进行认证并获得一个访问令牌,这使我有可能执行上述洞察数据请求。 So, it seems that with offline_access deprecation, i have no way to perform my insight request! 因此,似乎对于offline_access已弃用,我无法执行我的洞察请求! :) :)

How can I solve this problem? 我怎么解决这个问题? How can I obtain a correct and working access_token? 如何获得正确且有效的access_token? Please help me! 请帮我!

Thank you very much. 非常感谢你。

As long as you've enabled the "Deprecate Offline Access" setting in the Settings for your app at developers.facebook.com then all tokens will be automatically issued for 60 days. 只要您在developers.facebook.com的应用设置中启用了“弃用离线访问”设置,那么所有令牌将自动发布60天。

On May 1st Facebook will be switching "deprecate offline access" on for EVERYONE so it will become the default setting and all access tokens will be issued across the board with 60 day expiration time. 5月1日Facebook将为每个人切换“弃用离线访问”,因此它将成为默认设置,所有访问令牌将在60天到期时间内全面发布。

I'd look at the documentation page "Authentication for devices without access to a browser" which seems to most closely match your use case. 我会查看文档页面“无法访问浏览器的设备身份验证”,这似乎与您的用例最匹配。

http://developers.facebook.com/docs/authentication/devices/ http://developers.facebook.com/docs/authentication/devices/

without offline_access the access token returned will still be valid for 60 days ... so one approach would be to trace the expires time and then renew the token as needed... my personal opinion is that asking user to reenter login data every 60 days is more than acceptable 如果没有offline_access,返回的访问令牌仍然有效60天......所以一种方法是跟踪过期时间,然后根据需要更新令牌......我的个人意见是要求用户每60天重新输入一次登录数据是可以接受的

Details here https://developers.facebook.com/docs/offline-access-deprecation/ 详情请访问https://developers.facebook.com/docs/offline-access-deprecation/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM