Using Refresh Token

In this article

    To obtain a new pair of tokens in case the access token expires or becomes lost, a user sends the HTTP POST request to the api/v1/token endpoint. The request body must contain the grant_type parameter with the specified refresh_token value and the refresh token saved locally. A successfully completed operation returns the 200 response code and a new pair of tokens in the response body.

    Tip

    If you lose the refresh token, you can log in again under the same user account and get a new pair of tokens.

    Using Refresh TokenExample

    To obtain an access token and a refresh token, a user sends the HTTP POST request to the api/v1/token endpoint. In the x-api-version header, the user specifies the current revision of the Veeam Backup for GCP REST API.

    In the body of the request, the user specifies the following parameters:

    • grant_type — to refresh the token, it is required that the refresh_token value must be specified for this parameter.
    • refresh_token — the previously saved refresh token.

    Request:

    POST https://127.0.0.1:13140/api/v1/token

     

    Request Header:

    x-api-version:1.0-rev0

     

    Request Body:

    grant_type=refresh_token&refresh_token=eyJhbGciOiJSUzUxMiIsImtpZCI6IkVDQTM3OTczM0U5MzhDMjRBMjQzMkE4MTJBNzAwNEYzMzdBRTAyQjgiLCJ0eXAiOiJKV1QifQ.eyJ1bmlxdWVfbmFtZSI6InJvb3QiLCJ0b2tlbl9pZCI6IjE5Nzg2MDg4LTQzOTAtNGVkMi04ZTRhLTU0MjUxMDdiNGRlNCIsInNob3J0X3Rlcm1fZXhwaXJhdGlvbiI6IlRydWUiLCJuYmYiOjE2MTY3NzUyMzQsImV4cCI6MTYxNjc3OTczNCwiaWF0IjoxNjE2Nzc1MjM0LCJhdWQiOiJyZWZyZXNoIn0.xZ06XwQa7sYAiGxOJ9wtLbBB7zICuyT6gnEAY9dVtOEspqdGAUJ2IUTfrOPW3n7NdaYhnFQF5yvbsuBiVB_MLjIdnwo_Lx8ekBLZLeFKNZ446XeCzFLhRZYygcsh-S2cabztJrK6qjBeisY3LFk1UqccwhzKZg4dd-U-OxszMAR47KZCh1je4fpECNoMVkXkM9IjYJca-y73zIbrCZbb9JE2rdUiUdtO5olmbJYy5UpzetKSnLlZ2z2y7DRfudOqNg9SA9igQtxCvkVg_Bd2Wvqg5ctvLo31uXIU4nqnzI_54DFWJEHv-XEGone7ABqk0_lDmzgCTy4joaq1EzVRvw

    The server sends a response in the following format.

    Response:

    200

    Response Body:

    {

     "access_token": "eyJhbGciOiJSUzUxMiIsImtpZCI6IkVDQTM3OTczM0U5MzhDMjRBMjQzMkE4MTJBNzAwNEYzMzdBRTAyQjgiLCJ0eXAiOiJKV1QifQ.eyJ1bmlxdWVfbmFtZSI6InJvb3QiLCJuYmYiOjE2MTY3NzU0OTYsImV4cCI6MTYxNjc3NjM5NiwiaWF0IjoxNjE2Nzc1NDk2LCJhdWQiOiJhY2Nlc3MifQ.betVvdhQMLdzfvzYJXJ1vlWNcyf6Pr4MDW_sUqKFPWfymGNDN-w40Ko3Fs8WJPpJg1J6wLclVJlwdOx7i7zztvXGCzlsHrk3y3R2HQrGEra1UGQvwyAVC34W2uW7FAzXvu_-gO_RGhnUXsBFhXLNdHEdGPrCwRuSJlMXmm40GKeEU0hU33U14tESJc4kP4K-CiNetnsEcTGnwbMPPYcmOZDkbEREyaRAG9fFJUEinOAlEyoyxrd_-x0abKh6CP49wfDIbOeZ5GfRj8st24UodkdVhxiRL_8KBlkx_TyEBHDVicfGKM6jj-bZURX1-_WjyC8C2xfEojTPMrv04TFmvw",

     "token_type": "bearer",

     "refresh_token": "eyJhbGciOiJSUzUxMiIsImtpZCI6IkVDQTM3OTczM0U5MzhDMjRBMjQzMkE4MTJBNzAwNEYzMzdBRTAyQjgiLCJ0eXAiOiJKV1QifQ.eyJ1bmlxdWVfbmFtZSI6InJvb3QiLCJ0b2tlbl9pZCI6IjYxMzQ5ZWY3LTU5MmYtNDc1MC05MjMzLTk0Njc1ODNhM2EzMCIsInNob3J0X3Rlcm1fZXhwaXJhdGlvbiI6IlRydWUiLCJuYmYiOjE2MTY3NzU0OTYsImV4cCI6MTYxNjc3OTk5NiwiaWF0IjoxNjE2Nzc1NDk2LCJhdWQiOiJyZWZyZXNoIn0.PLu1zzFuESSrGAlxnV2LYqQkL8sYw4bX2XeAYWRd7fVcGaKy_5WTlZ-6y8kwrOhW0cU7QdLEfBYYqS23PutHKfH5UG-MsD3T8kUfSYeritHQvGW8ATnv6VMoQ9xqJsY91YRefV-GIi9ZZWwChiiXsDNsENvOw9xGymLfRzvhfH63FAiwAQuRJkHvuD7a1gwgwBYU0k4NE60hX2d_kp6bTiY-oKKGZg10hRCBR5JgkM8oxLFxfmOfT7xyNa9E2oFjZrcIzD7bvnlPr5JtDmOcuqVB2ImLe4CQBBCnQ4OGA9k7YkRm2HaRZjqMRWglav1o5SThMYld9WYCRNIkwrahMA",

     "expires_in": 900,

     ".issued": "2021-03-26T16:18:16",

     ".expires": "2021-03-26T16:33:16"

    }