Get facebook access token with java code

8.1k views Asked by At

I have 2 questions:

    1. I am trying to get access token through java code and not through Facebook developers site. Does anyone have idea how can I do it?
    1. is it possible to get longer access token that expires after more than 1 hour ?

I read about some options but not something that is possible to me as simple user in Facebook.

1

There are 1 answers

4
andyrandy On

This article in the Facebook docs explains everything you need to know about Access Tokens: https://developers.facebook.com/docs/facebook-login/access-tokens/

An App Access Token can be used without User authorization, for every other Token you need authorization: https://developers.facebook.com/docs/facebook-login/v2.2

I suggest trying one of the third party SDKs for Java: https://developers.facebook.com/docs/other-sdks

App Access Tokens are valid forever, Extended Page Tokens too. User Tokens can only be extended to 60 days max, by default they are valid for only 2 hours.