Authorization with Service Account

To use the vStorage APIs, users will use the client ID and the client secret keys to be authorized via the authorization server (https://iamapis.vngcloud.vn/accounts-api/v2/auth/token) using the OAuth2 method.

Header

'Authorization':'Basic Base64(clientID:clientSecret)'

Request body

'grant_type':'client_credentials'

'scope':'email'

Response

'token_type':'bearer' 'access_token':'koxoQrfdAhCFIRl1Sy897kRuHcOlswcW' 'expires_in':7200

If the credentials are authorized, an access_token will be returned. Users will use this access_token to access resources from the resource server.

Example:

curl -X POST 'https://iamapis.vngcloud.vn/accounts-api/v2/auth/token' -H 'Content-Type: application/json' -H 'Authorization: Basic ZGM3MTYxNTYtMjQwMi00MDg2LTliYWItZGU5OTIxODVlYjU1OmJhYjYzYTZmLWYzOGUtNDZmNC05NjIyLTYzNTQwNGQ4MDFlNQ==' -d '{ "grant_type": "client_credentials", "scope":"email" }'

{"token_type":"Bearer","access_token":"eyJhbGciOiJSUz......GWug","expires_in":1800,"refresh_expires_in":0}

Last updated