This is an archive version of the document. To get the most up-to-date information, see the current version.

Authorization and Security

In this article

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

    • Access token is a string that represents authorization issued to the client and must be used in all requests during the current logon 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 RESTful API authorization process involves the following procedures:

    Requesting Authorization

    To obtain a pair of tokens, the client sends the POST HTTPS request to the Veeam Backup for Microsoft Office 365 RESTful 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 Success response code and an access and a refresh token in the response body. The client inserts the access token in headers of further requests to Veeam Backup for Microsoft Office 365 RESTful API. The refresh token must be saved locally.

    Authorization and Security Tip:

    To learn how to authorize your access using a client application, you can review the Example Requests and Responses section. Alternatively, you can use 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 RESTful API token path. A successfully completed operation returns the 200 Success response code and a new pair of tokens in the response body.

    Performing Logout

    The given access token expires in 60 minutes once it is issued. When the client finishes working with the Veeam Explorer for Microsoft Exchange, Veeam Explorer for Microsoft SharePoint or Veeam Explorer for Microsoft OneDrive he can stop his restore session manually through (POST) /RestoreSessions/{ID}/Action or it will be disabled automatically.

    Example Requests and Responses

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

    1. To obtain an access and a 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://support.east.local:4443/v3/Token

     

    Request Body:

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

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

    Response:

    200 OK

     

    Response Body:

    {

     "access_token":"AQAAANCMnd8BFdER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xvrpns4IXaE0z_VAnUYLOkT-ep-uiouWd_Jw",

     ".issued":"Thu, 04 April 2017 14:33:40 GMT",

     ".expires":"Fri, 04 April 2017 15:33:40 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://support.east.local:4443/v3/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.