silent_coder
silent_coder

Reputation: 6532

Facebook get access_token by username/password

I implement some facebook related stuff and accessing graph api for that pourposes. But for implement Integration testing I need a simple strategy to get access_token. So I create test user for that. How could I get access_token only with server side involved, without including browser in the chain. Ideally I just need to exchange login/password to the token.


Correct workflow loooks like this:

According the correct answer, there is special tests users provided by facebook. To to be able to tests system properly you need to do the following flow

  1. Get application access token
  2. Request application's tests user's via "GET /{app_id}/accounts/test-users"
  3. Parse response and extract access_tokens for each user from that response.

Upvotes: 0

Views: 325

Answers (2)

andyrandy
andyrandy

Reputation: 74014

Short answer: You can´t.

Server side you can only get an App Access Token, Page Access Token or extend an existing Access Token.

So it depends on what you need to achieve, if you just want to get public stuff from a Facebook Page, even an App Access Token may be good enough. But you cannot create User Access Tokens server side.

It may be possible with real test users created via the Graph API itself though, see Tobis answer for links about that. But it is definitely not possible with username/password.

Upvotes: 1

Related Questions