Obtaining Token
This section explains how to obtain a pair of access and refresh tokens.
Request
POST https://<hostname>/api/oauth2/token |
Request Headers
The following request header must be sent.
Header | Property |
|---|---|
Content-Type | application/x-www-form-urlencoded |
Request Parameters
None.
Request Body
The following parameters must be sent in the request body.
Property | Type | Required | Description |
Username | string | Yes | Sets the user name under which to authenticate on the target Veeam Backup for Microsoft Azure server. |
Password | string | Yes | Sets the password for the specified user. |
refresh_token | string | Yes | Sets the refresh token. |
grant_type | string | No | Sets the grant type. The following parameters are possible:
|
mfa_token | string | No | Sets the MFA token. |
mfa_code | string | No | Sets the MFA code. |
api-version | string | No | Sets the API version. |
Request Example
Request: POST https://<hostname>/api/oauth2/token
Request Header: Authorization: Bearer <Access-Token>
Request Body: { grant_type=Password&Username=Administrator&Password=XXXXXX } |
Response
The server returns the following response to the client.
Response Codes
A successfully completed operation returns a response code 200 (OK).
Response Headers
The response to this request contains the following headers. The response may also include additional standard HTTPS headers.
Header | Description |
Content-length | The length of the response body. |
Content-type | The media type and syntax of the response body message: application/json; charset=utf-8 |
Response Body
The response contains the following information.
Property | Type | Description |
|---|---|---|
access_token | string | Contains the access token. |
token_type | string | Contains the type of the token. |
refresh_token | string | Contains the refresh token. |
expires_in | int32 | Shows the date when the token expires in seconds. |
.issued | string | Shows the date when the token was issued, |
.expires | string | Shows the date when the token expires. |
username | string | Shows the username to which the token was granted. |
roleName | string | Shows the name of the role to which the token was granted. |
mfa_enabled | boolean | Shows if the MFA is enabled. |
mfa_token | string | Shows the MFA token (if enabled). |
Response Example
Response: 200 OK
Response Body: { "access_token": "eyJhbGciOiJSUzUxMiIsImtpZCI6IjVCNThDRkZBN0ZCQjFCNjcyRTI2Mzk2OUMwRjMwOEU2MzAwNzFCQjciLCJ0eXAiOiJKV1QifQ.eyJ1bmlxdWVfbmFtZSI6ImJvZ2F0b3YiLCJuYmYiOjE1NzkxODQzNDEsImV4cCI6MTU3OTE4Nzk0MSwiaWF0IjoxNTc5MTg0MzQxLCJhdWQiOiJhcG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iR9EBIULRx8yYHJWBl7t4BfqJPnwJzYN0I80Y8gfseDEDZiQLLA", "expires_in": 3600, ".issued": "2020-01-16T14:19:01.1224701Z", ".expires": "2020-01-16T15:19:01.0864115Z", "username": "Administrator", "roleName": "Administrator", "mfa_enabled": false } |