1
0
forked from docs/doc-exports
doc-exports/docs/opengauss/api-ref/opengauss_api_0010.html
Ru, Li Yi d97aea4dd2 opengauss_api
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>
2024-09-06 09:04:21 +00:00

5.0 KiB

Authentication

Token authentication must be performed to call APIs.

Token-based authentication: Requests are authenticated using a token.

Token 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. During API authentication using a token, the token is added to requests to get permissions for calling the API.

{ 
     "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 a token is obtained, add the X-Auth-Token header field must be added to requests 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....