user1688181
user1688181

Reputation: 492

How to get Facebook AccessToken?

I have a Facebook Session.but it is not open. i tried to get AccessToken as follows

Session.getActiveSession().getAccessToken();

but it does not return any thing.how can i get the AccessToken?

Upvotes: 1

Views: 283

Answers (2)

Ming Li
Ming Li

Reputation: 15662

You almost never need to extract the actual access token anymore. Any requests to the graph API can be done with the Request class and a Session object.

Upvotes: 0

thepoosh
thepoosh

Reputation: 12587

well, as written in the official documentation, you need to have a UiLifecycleHelper that will make sure to create a valid session for every fragment that interacts with the Facebook SDK.

what you should do is override the life cycle methods in your fragment (or activity) and then Session.getActiveSession() will return a session if there is one.

Upvotes: 1

Related Questions