Reviewed-by: Boka, Ladislav <ladislav.boka@t-systems.com> Co-authored-by: Ru, Li Yi <liyiru7@huawei.com> Co-committed-by: Ru, Li Yi <liyiru7@huawei.com>
4.5 KiB
Authentication
Token authentication is required to call APIs.
Authentication using tokens: General requests are authenticated using tokens.
Token-based Authentication
The validity period of a token is 24 hours. If a token is required, the system caches the token to avoid frequent calling.
A token specifies temporary permissions in a computer system. Token-based authentication adds a token in a request as its header during API calling to obtain the permissions for operating APIs on IAM.
{
"auth": {
"identity": {
"methods": [
"password"
],
"password": {
"user": {
"name": "username",
"password": "********",
"domain": {
"name": "domainname"
}
}
}
},
"scope": {
"project": {
"name": "xxxxxxxx"
}
}
}
}
In Making an API Request, the process of calling the API used to obtain a user token is described.
After obtaining the token, add the X-Auth-Token header in a request to specify the token when calling other APIs. For example, if the token is ABCDEFJ...., X-Auth-Token: ABCDEFJ.... can be added to a request as follows:
1 2 3 | POST https://{{Endpoint}}/v3/auth/projects Content-Type: application/json X-Auth-Token: ABCDEFJ.... |