Back

POST Token

Using OAuth2 to get a valid bearer token.

The path for generating tokens will be :”{url}/token”. {url} is the url of the Web API.Token expires in 14 days, so if the user tries to use the same token for authentication after 14 days from the issue time, his request will be rejected and HTTP status code 401 is returned.
Content type for this request is 'application/x-www-form-urlencoded'.
To get a valid token grant_type must be 'password' and username a valid email address.
Special characters in the password must be percent encoded. For example: ! should be %21 , # should be %23.

Request Information

URI Parameters

None.

Body Parameters

Token request parameters

TokenRequestModel
NameDescriptionTypeAdditional information
grant_type

For authorization token grant_type is 'password'

string

Required

username

Username i.e. the email address used for registration.

string

Required

password

User password

string

Required

Sample Request

Request Formats

Response Information

Resource Description

TokenResponseViewModel
NameDescriptionTypeAdditional information
access_token

Access token string

string

None.

token_type

Type of token

string

None.

expires_in

Expiration detail

integer

None.

userName

Username

string

None.

.issued

Issue date

string

None.

.expires

Expiration date

string

None.

Sample Response

application/json, text/json

Sample:
{
  "access_token": "q1XLYKcLUzlAqysMJBNazWeFeRasDYIpTjjhW_JLMZl1G",
  "token_type": "bearer",
  "expires_in": 1209599,
  "userName": "name@example.com",
  ".issued": "Thu, 06 Nov 2014 19:08:24 GMT",
  ".expires": "Thu, 20 Nov 2014 19:08:24 GMT"
}