Authorization and Security

In this article

    To start working with Veeam Backup for Microsoft Office 365 REST API, clients must first authenticate themselves. Veeam Backup for Microsoft Office 365 REST API authorization process is based on the OAuth 2.0 Authorization Framework and involves obtaining an access token and refresh token:

    • Access token is a string that represents authorization issued to the client and must be used in all requests during the current session.
    • Refresh token is a string that represents authorization granted to the client and can be used to obtain a new access token when the current access token expires.

    Veeam Backup for Microsoft Office 365 REST API authorization process involves the following procedures:

    Requesting Authorization

    To obtain a pair of tokens, a client sends the POST HTTPS request to the Veeam Backup for Microsoft Office 365 REST API token path. The request body must contain credentials for authenticating with the Veeam Backup for Microsoft Office 365 server.

    A successfully completed operation returns the 200 OK response code and an access and refresh tokens in the response body. The client inserts the access token in headers of further requests to Veeam Backup for Microsoft Office 365 REST API. The refresh token must be saved locally.

    Authorization and Security Tip

    For more information on how to authorize your access using a client application, see Example Requests and Responses. Alternatively, you can use Swagger UI. For more information, see Evaluation in Swagger UI.

    Using Refresh Token

    To obtain a new pair of tokens in case the access token expires or becomes invalid, the client sends the POST HTTPS request with the refresh token in the request body to the Veeam Backup for Microsoft Office 365 REST API token path. A successfully completed operation returns the 200 OK response code and a new pair of tokens in the response body.

    Performing Logout

    The given access token expires in 60 minutes once issued. When the client finishes working with the Veeam Explorer for Microsoft Exchange, Veeam Explorer for Microsoft SharePoint, Veeam Explorer for Microsoft OneDrive for Business or Veeam Explorer for Microsoft Teams, they can stop the restore session manually, as described in Stopping Restore Sessions. Otherwise, the session will be stopped automatically.

    Example Requests and Responses

    The following example illustrates how the client and server communicate using requests and responses.

    1. To obtain access and refresh tokens, send the POST HTTPS request to the Veeam Backup for Microsoft Office 365 token path. In the request body, enter the credentials for authenticating with the Veeam Backup for Microsoft Office 365 server.

    Request:

    POST https://abc.tech.local:4443/v5/Token

     

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

     

    Request Body:

    grant_type=password&username=tech\administrator&password=PassWord1

    Wait for the response from the server. A successfully completed operation returns the response code 200 OK.

    Response:

    200 OK

     

    Response Body:

    {

      "access_token": "AQAAANCMnd8BFdERjHoAwE_Cl-sBAAAABVmqktPnnkGniIRB_FgzAQAAAAACAAAAAAAQZgAAAAEAACAAAAA5o4nSCb8GXou5XAO-Q-VFCmnPDip6a8DRNq5MpEAduQAAAAAOgAAAAAIAACAAAABpg434BmHtB0qCmhx9YbSJ3vvelW812u-KrXbfHq3Ao7AAAAARtdm0OeX3WwfhHZddNz_AcZQJVqeqryM2HVdQN3R-XAkBwGFTLIz38GWT5968B08iOT9kVdFMexijWdWwLbmExXH-npxGpvZgXEuZyOn1167PAHaMzYLB9SZjx_3l_t9hcv7oO9mUGfI7l_gAfthE7VV3mosmb4l2v8wkzLm6umdvA01EMFmNM0Jt3cFSmFgo6EhdKhQodb3AyzzCgXpDRjjhk_v_RkNQy26nBl_iEUAAAAA3km9-J1s721ChkCkMtKILUmB41ipRaxJZP_M-DyUSzvRr-FpVYwZ46gd6_T_N6jEL4nzovK0h2VJpLf9m-RdL",

      "token_type": "bearer",

      "expires_in": 3600,

      "refresh_token": "AQAAANCMnd8BFdERjHoAwE_Cl-sBAAAABVmqktPnnkGniIRB_FgzAQAAAAACAAAAAAAQZgAAAAEAACAAAACJYGmlmvWP4qPFv7Rb2zLwvi3xEdVHfKrFbY9LPSsTZAAAAAAOgAAAAAIAACAAAAARnNKvOfWKr-oJWSZ302BB1LVSjCTn7L2Tm8XVYywM6uAAAAA-tzV1Uqr1mAGtGLzgM0ldpI-4Hs0Q-hOsOz1xoGljX6xP5P4zS3pGaAT3zQMPCUTJuflQAOqcN8gWwGnojWyyK_jhCS-2u7ikZ1uHew8ZOg78Ixb0_JQiN_nvrTpix270Px8U_QKPfIbtxVMUzYvqQtGmnBHDRA17HvTig2IPpm1MA5K19fW_XxEvmXh_XKQNZWxoqVPYjBTxDlQlSqZlhS7xu2VOHG9yYs3Hmq2wLLfytA9xsAdPHElKRUb-LAsr01HQNCafwWTl40KmdHHTpJTJkKKOfLLNCSaVW36pOkAAAACAt8nEqjlZc00TC-RsLZBAOeHafVStZhlURjbXBMW_F5ZBXKz-VZlMQ8KRM7E7OBDfDb4EpTEZE7Zq7lNg5jjq",

      ".issued": "Wed, 06 Nov 2019 14:43:48 GMT",

      ".expires": "Wed, 06 Nov 2019 15:43:48 GMT"

    }

    The response body contains access and refresh tokens. Copy both tokens, insert an access token in headers of further requests. A refresh token must be saved locally.

    1. When an access token expires you can either obtain it again or renew using a refresh token. To renew the access token, send POST HTTPS request to the Veeam Backup for Microsoft Office 365 token path. In the request body, enter the refresh token.

    Request:

    POST https://abc.tech.local:4443/v5/Token

     

    Request Body:

    grant_type=refresh_token&refresh_token=<refresh_token>

    Wait for the response from the server. A successfully completed operation returns response code 200 OK and a new pair of tokens in the response body.

    I want to report a typo

    There is a misspelling right here:

     

    I want to let the Veeam Documentation Team know about that.