Chứng thực với Service Account
Để sử dụng vStorage APIs, người dùng sẽ sử dụng khóa client ID và client secret để được chứng thực thông qua máy chủ (https://iamapis.vngcloud.vn/accounts-api/v2/auth/token) dùng phương thức OAuth2.
Header
'Authorization':'Basic Base64(clientID:clientSecret)'
Request body
'grant_type':'client_credentials'
'scope':'email'
Response
'token_type':'bearer' 'access_token':'koxoQrfdAhCFIRl1Sy897kRuHcOlswcW' 'expires_in':7200
Nếu thông tin đăng nhập được xác thực, một access_token sẽ được trả về. Người dùng sẽ sử dụng access_token để truy cập tài nguyên.
Ví dụ:
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
