Appearance
POST /oauth2/token/
Description
The Authorization resource provides OAuth 2.0 API access tokens. This flow does not deal with an end-user but in this case the application itself is assumed to be the resource owner. The application requests the authorization server for an access token in exchange for client_id and client_secret. The client_id and client_secret are provided when creating an application.
Authentication
- Required: Yes
- Method: Client credentials
Headers
- Content-Type:
application/x-www-form-urlencoded
Parameters
Body Parameters
- grant_type:
string
Values:client_credential
Set to 'client_credential' for the client credential flow. - client_id:
string
The value that was provided when registering the application. - client_secret:
string
The value that was provided when registering the application. - scope:
string
Desired scopes. If more than one, comma-separated.
Values:me: Gives access to account owner's personal data via the "Users" APImediahub: Gives access to all MediaHub APIs (except autograph features) permitting all actions.mediahub_read: Allows read access to all MediaHub APIs.mediahub_write: Allows write access to all MediaHub APIs.mediahub_submit_jobs: Is a restricted scope that provides just those rights needed to post new jobs to the Jobs API but nothing else.mediahub_download_files: Is a restricted scope that provides just those rights needed to download files or stream videos that are specified by file id or object path.autograph: Gives access to all AutoGraph-specific API features.
- expires_in:
integer(Optional)
Time in seconds indicating after which time period the access_token shall expire. - format:
string(Optional)
Values:json,xml - human:
boolean(Optional)
Values:true,false
If set to 'true', it causes the response to be in a structured, more human-readable form.
Example Request
bash
curl -X POST -d 'scope=mediahub,autograph&grant_type=client_credential&client_id=c53067b79169464aa3139c78&client_secret=ZqdEFsMX8OWz8yZAAHoy4zM1k0peftMpaPE5pyWo1XgDXGIGoJRtHJJJxwP8crq3' "https://api.xvid.com/v1/oauth2/token/?human=true&expires_in=7200"Response
Success (200 OK)
json
{
"access_token": "5JffwBZ_PDAg6qioaTZqHYsLqEVL2ygyKrgoAH3TRLjNxN0mEecDRodAUtjV00ti",
"expires_in": "7200"
}Error Responses
400 Bad Request
json
{
"error": {
"error_code": "0x0220002",
"error_message": "Scopes requested are not allowed"
}
}402 Payment Required
json
{
"error": {
"error_code": "0x0220001",
"error_message": "Application does not exist"
}
}500 Internal Server Error
json
{
"error": {
"error_code": "0x0000001",
"error_message": "Internal Error"
}
}