简体   繁体   English

获取Facebook页面的NON-EXPIRING访问令牌

[英]Obtain NON-EXPIRING access token for a Facebook Page

i would obtain (trought whatever Facebook API for Java) a non-expiring access token for my page; 我将获得(尝试使用Java的任何Facebook API)我页面的未过期访问令牌; i've followed some other guides on stackoverflow but no one works for me. 我遵循了关于stackoverflow的其他一些指南,但是没有人适合我。

I need to do an autologin, and obtain the non-expiring access token, without using the web! 我需要进行自动登录,并获取未过期的访问令牌,而无需使用网络!

What's the best way ? 最好的方法是什么?

Actually i have just a page id, secret and login credentials 实际上我只有一个页面ID,秘密和登录凭据

You can do this via the Graph API endpoint 您可以通过Graph API端点执行此操作

/me/accounts

Be sure to have a User AccessToken which has manage_page permisions. 确保有一个具有manage_page权限的User AccessToken。

Try it here: 在这里尝试:

https://developers.facebook.com/tools/explorer?method=GET&path=me%2Faccounts https://developers.facebook.com/tools/explorer?method=GET&path=me%2帐户

To use this via JS SDK look here: https://developers.facebook.com/docs/javascript/quickstart#graphapi 要通过JS SDK使用此功能,请参见: https : //developers.facebook.com/docs/javascript/quickstart#graphapi

Sample code: 样例代码:

FB.api('/me?fields=accounts.fields(id,name,access_token)', function(response) {
  console.log(JSON.stringify(response));
});

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

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