简体   繁体   中英

How do I generate access token for facebook (restfb) which is never expired? (java)

I'm trying to generate access token for specific user on facebook for restfb so i could share photos with my java app. I succeded to generate the token by entring facebook and copying it into my code. My question is is there any way to generate to token from the code itself? And if so how can i support the upload even when the user is not connected to facebook? Because i'm getting the error:

Exception in thread "main" com.restfb.exception.FacebookOAuthException: 
Received Facebook error response of type OAuthException:
Error validating access token: The session is invalid because the user logged out. 
(code 190, subcode 467)

Thanks a lot.

Facebook allows you to generate long lived token that lasts 60 days maximum. You have no option to create non-expiring token. You might want to extend it, but it cannot be generated as non-expiring token, as described here: https://developers.facebook.com/docs/facebook-login/access-tokens#extending

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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