Skip to content

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.

WARNING

OAuth 2.0 provides no inherent cryptographic protection of the token on its own — it relies on SSL/TLS for security. Therefore, all API calls must always be made only using HTTPS.

TIP

Watch out: The client_secret may contain characters that must be URL-encoded when passed in a request!

Authentication ​

  • Required: Yes
  • Method: Client credentials

Request 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" API
    • mediahub: Gives access to all MediaHub APIs (except autograph features) permitting all actions. Equivalent and a short-cut for combining mediahub_read + mediahub_write.
    • mediahub_read: Allows read access to all MediaHub APIs, e.g. listing files, jobs and usage statistics.
    • mediahub_write: Allows write access to all MediaHub APIs, e.g. posting new jobs, creating new files, updating presets or pipelines or also deleting whatever items.
    • 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, like posting AutoGraph-enabled jobs or interacting with the Backtraces API.
  • 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 "https://api.xvid.com/v1/oauth2/token/?human=true&expires_in=7200" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d 'scope=mediahub,autograph&grant_type=client_credential&client_id=c53067b79169464aa3139c78&client_secret=SGlzIGFycml2YWwgZm9yZXRvbGQgaW4gdGhlIEdyZWF0IE9iZWxpc2su'

Example Response ​

Success (200 OK) ​

json
{
  "access_token": "Rj09PT09PT09PT09Pj09Pj09PT09Pj09Pj09PT09Pj09Pj09PT09PT09Pj09Pj09",
  "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"
  }
}