Website

Oauth2 – Generate authorization token

Last update: 11.03.2024

All resources exposed by API are restricted ones and user authentication (and subsequent authorization with token) is required to access .

POST: https://www.autovit.ro/api/open/oauth/token

Parameter

Field Type Description
client_id Number Unique API client ID
client_secret String Client secret code
grant_type String Allowed grant types: "password" or "partner"
username String Only for "password" grant type - user login (email)
password String Only for "password" grant type - user password
partner_code String Only for "partner" grant type - partner name
partner_secret String Only for "partner" grant type - partner password
Example curl request for "password" grant_type
		curl -X POST
    -u client_id:client_secret
    -d "grant_type=password"
    -d "username=user@sneaky.domain"
    -d "password=gimmeaccess"
    http://{example.com}/api/open/oauth/token			
		
Copied to clipboard
Example raw request for "partner" grant_type
		POST /oauth/token HTTP/1.1

Content-Type: application/x-www-form-urlencoded

client_id=123&client_secret=02468abcdef&partner_code=partner-name&partner_secret=secret-code&grant_type=partner			
		
Copied to clipboard

Success 200

Field Type Description
access_token String Authorization token to be used in subsequent requests
token_type String "bearer" only
expires_in Number Number of seconds to expire
refresh_token String Refresh token
scope String Access scope
Success response
		HTTP/1.1 200 OK
{
    "access_token": "4df20e702bfaeee96ecd6cbbc4ff384c166f5567",
    "token_type": "bearer",
    "expires_in": 43200,
    "refresh_token": "3901415998eb583aedabd027b93578df25ef93c6",
    "scope": "adverts-write read"
}			
		
Copied to clipboard
Error response example:
		HTTP/1.1 400 Bad request
{
    "error": "invalid_grant",
    "error_description": "Invalid partner credentials parameter",
    "error_human_title": "Niepoprawna wartość",
    "error_human_message": ""
}			
		
Copied to clipboard