Authentication
Vietnix Cloud API uses token-based authentication to ensure secure access to its services. The authentication process involves obtaining a token by providing valid credentials, which is then used in subsequent API requests to authorize access.
Obtaining an Authentication Token
To obtain an authentication token, you need to send a POST request to the authentication endpoint with your credentials. The request should include the following information:
- Username: Your Vietnix Cloud account username.
- Password: Your Vietnix Cloud account password.
- Project Name: The project you want to access (if applicable).
- Domain ID: The domain associated with your account (if applicable). Here is an example of a request to obtain an authentication token:
Sample Request
Using curl
curl -ksD - -o /dev/null -H 'Content-Type: application/json' -d '
{
"auth": {
"identity": {
"methods": [
"password"
],
"password": {
"user": {
"name": "user-1234",
"domain": {
"id": "921940ee9d6c465daa555fcc3e3764a2"
},
"password": "password1234"
}
}
},
"scope": {
"project": {
"name": "project-1234",
"domain": {
"id": "921940ee9d6c465daa555fcc3e3764a2"
}
}
}
}
}' https://api.vietnix.cloud/v3/auth/tokens
Using HTTP request
POST https://api.vietnix.cloud/v3/auth/tokens
with body:
{
"auth": {
"identity": {
"methods": [
"password"
],
"password": {
"user": {
"name": "user-1234",
"domain": {
"id": "921940ee9d6c465daa555fcc3e3764a2"
},
"password": "password1234"
}
}
},
"scope": {
"project": {
"name": "project-1234",1
"domain": {
"id": "921940ee9d6c465daa555fcc3e3764a2"
}
}
}
}
}
Sample Response
A successful response will include an authentication token in the X-Subject-Token header and a JSON body containing details about the authenticated user and their roles.
HTTP/1.1 201 CREATED
Server: nginx
Date: Fri, 24 Jan 2020 12:42:01 GMT
Content-Type: application/json
Content-Length: 7947
Connection: keep-alive
X-Subject-Token: gAAAAA<...>
Vary: X-Auth-Token
x-openstack-request-id: req-f732464d-62b4-44fd-92fa-ea368efc9a36