doc-exports/docs/geminidb/api-ref/nosql_05_0009.html
Ru, Li Yi 37b97ffc06 geminidb_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-07-04 11:26:33 +00:00

2.8 KiB

Authentication

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

If you want to use a token for authentication, you need to obtain the user's token and add X-Auth-Token to the request header of the service API to make an API call.

When you call an API to obtain a user token, set auth.scope in the request body to project.

{
    "auth": {
        "identity": {
            "methods": [
                "password"
            ],
            "password": {
                "user": {
                    "name": "username",
                    "password": "password",
                    "domain": {
                        "name": "domainname"
                    }
                }
            }
        },
        "scope": {
            "project": {
               "name": "xxxxxxxx"
             }
        }
    }
}

After a token is obtained, add field X-Auth-Token to the request header to specify the token when other APIs are called. For example, if the token is ABCDEFJ...., add X-Auth-Token: ABCDEFJ.... to a request header as follows:

 
POST https://{{Endpoint}}/v3/auth/projects
Content-Type: application/json 
X-Auth-Token: ABCDEFJ....