Skip to content
Nikola Begedin edited this page Nov 10, 2015 · 9 revisions

POST /oauth/tokens

Used to log in as a regular user, or to both login and register as a Facebook user.

Data payload to login as a regular user:

{
  grant_type: 'password', // this is fixed
  username: '[email protected]',
  password: 'somepassword'
}

Example response:

{
  access_token='331afce6d4d9d71350a2c52d1050a271e9d95346403037bf95ba3ab268b499b7',
  expires_in=7200,
  token_type='bearer',
  user_id='455',
  created_at=1443510836
}

Property names are part of the standard format for password grant type, which is why the name of the property is username and not email.

Data payload to login and/or register as a facebook user:

{
  username: 'facebook',
  password: <facebook_access_token>
}

If the user already exists, then they will simply be logged in. If not, they will be registered and logged in. Facebook account details such as first/last name will be used to fill in the new user details.

Example response:

{
  access_token='331afce6d4d9d71350a2c52d1050a271e9d95346403037bf95ba3ab268b499b7',
  expires_in=7200,
  token_type='bearer',
  user_id='455'
}
Clone this wiki locally