Refresh an Access Token
To ensure secure and seamless communication between Milesight Development Platform and applications, you need to refresh the access token before it expires.
Request URL
POST {base_url}/oauth/token
Request Parameters
Parameter | Required | Type | Description |
---|---|---|---|
refresh_token | Yes | String | The latest refresh_token value. |
grant_type | Yes | String | The OAuth grant type for refreshing an access
token. Valid value:
|
Response Parameters
Parameter | Type | Description |
---|---|---|
data | Object<Token_Details> | Details of the requested tokens. |
status | String | The result of the API request.
|
requestId | String | The unique ID of the request, which can be used to quickly locate the request. |
- Token_Details
-
Parameter Type Description access_token String The new access token. refresh_token String The new refresh token. expires_in Integer The remaining validity period of the new access token (Unit: second). refresh_token_expires_in Integer The remaining validity period of the new fresh token (Unit: second).
Examples
- Request example
-
Refresh an access token.
POST /oauth/token HTTP/1.1 Host: demo.milesight.com Content-Type: x-www-form-urlencoded refresh_token=eyJhbGciOiJSUzIxxxxxxxxxxx&grant_type=refresh_token
- Response example
-
HTTP/1.1 200 OK { "data": { "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6InllYXN0b25lLWRlZmF1bHQta2V5LWlkIn0.eyJncmFudF90eXBlIjoiY2xpZW50X2NyZWRlbnRpYWxzIiwic2NvcGUiOlsib3BlbmFwaSJdLCJjbGllbnRfZXh0Ijp7ImFwcF9pZCI6IjE3MzQ0NzUwODY0NjY2MDA5NjIifSwiZXhwIjoxNzAyNDYxNDM3LCJhdXRob3JpdGllcyI6WyJST0xFX0NMSUVOVCJdLCJqdGkiOiIwNWNjN2RjYS1jNGZkLTQ1M2ItYTZmYy01ZWI1YWQ1MTdiM2UiLCJjbGllbnRfaWQiOiJlZTZhZDY1MC03ZDMzLTQxNGQtYmFmYi0wODM3YjNlMzQzMWQiLCJ0cyI6MTcwMjQ1NzgzNzk4MH0.WeEy_eq9Y8fKzrSx4mAIkJfIuu9MCwjGW8XrQ0Z28eAP5jD_WblhnN6T7oGrgvL1fnmol3KDCqeKLVR6QUuuYrTDEICc_ZFGOY_WvLGgRpmstu86V1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