Updated on 2024-07-30 GMT+08:00

Authentication

Currently, KooDrive uses token-based authentication.

Requests are authenticated using a token.

Token-based Authentication

A token is valid for 20 minutes. If an API is called within the validity period of the token, the validity period is reset. If no operation is performed within the validity period, the token becomes invalid.

Ensure that the token is valid when you use it. Using a token that will soon expire may cause API calling failures.

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.

A token is obtained from the cookies after you log in to the service frontend. As shown in Figure 1, the value of Authorization is the AT to be obtained.

Figure 1 Obtaining a token

After a token is obtained, the Authorization header field must be added to requests to specify the token when calling other APIs. For example, if the token is ABCDEFJ...., Authorization: ABCDEFJ.... can be added to a request as follows:

POST https://intl.myhuaweicloud-koodrive.com/koodrive/ose/v1/files/batch
Content-Type: application/json
Authorization: xxx