Julio Diniz
Julio Diniz

Reputation: 21

Facebook FB api - About Access token

Each user who allow permission to my app will have an access token

or

One access token can handle actions, for example, upload photos to an user album?

I know that an access token can expire up to 60 days, so do I need save this access token for each user on my database and when request comes from that user, load the access token for him?

Upvotes: 0

Views: 380

Answers (3)

Athlan
Athlan

Reputation: 6629

Each user sends you another access token in context to use User session of course.

An access token is a random string that provides temporary, secure access to Facebook APIs.

A token identifies a User, App or Page session and provides information about granted permissions.

And in User Access context:

You can use this token to perform API calls on behalf of a user, including reading, publishing and deleting, depending on the permissions your app has. For example, you can retrieve a user's friend list or publish a new photo to their timeline with a user access token.

http://developers.facebook.com/docs/concepts/login/access-tokens-and-types/

Yes, you have to remember this access token if you dont want to reconstruct it. But in many API's this is done "automagically", for e.x. in PHP SDK the access token is stored in user cookie. If you implement more complicated user-flow, you have to remember access token OR regenerate it each time (http://developers.facebook.com/docs/concepts/login/login-architecture/). Remember, that access token will expire and you will have to regenerate it (on the faith of already granted permissions).

FYI: If you want to preserver offline access (executing application activities without user session), you will consider offline_access, but it is deprecated: http://developers.facebook.com/roadmap/offline-access-removal/

Hope it revealed the problem.

Upvotes: 0

Smita
Smita

Reputation: 4634

Each user who allow the app will have an access token, which will include all the permissions user has granted to your app.Read more about user access tokens here

Upvotes: 2

Piyas De
Piyas De

Reputation: 1764

Each user who allow permission to fb app, will have different Access Token which will be unique.

The Access Token is generated on the basis of browser session from client, AppID and App Secret. In a web server based application, it is not absolute requirement to save application token for user. But application like HootSuite saves user credentials and access token for later use to get facebook feeds and other services.

So it depends on application requirement.

Thanks

Upvotes: 1

Related Questions