About token you need to know

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/devcloud/article/details/102543329

First, token generation

1) token generation interface

https: // {your endpoint} / v3 / auth / tokens

For example, I was in Beijing a, my endpoint is iam.cn-north-1.myhuaweicloud.com, if you are in other regions, can refer to the region and the terminal

2) to bring Oh header, as shown in FIG.

3) transfer body matter of course, examples are as follows:

 1 {
 2 
 3   "auth": {
 4 
 5     "identity": {
 6 
 7       "methods": [
 8 
 9         "password"
10 
11       ],
12 
13       "password": {
14 
15         "user": {
16 
17           "name": "你的用户名",
18 
19           "password" : " Your password " ,
 20 is  
21 is            " Domain " : {
 22 is  
23 is              " name " : " or your user name " 
24  
25            }
 26 is  
27          }
 28  
29        }
 30  
31 is      },
 32  
33 is      " scope " : {
 34 is  
35        " Project " : {
 36  
37 [          " name " : "cn-north-1"  // if you are in the area of a Beijing, to fill the place that
 38 is  
39                                             // If not the reference area and the terminal 
40  
41 is        }
 42 is  
43 is      }
 44 is  
45    }
 46 is  
47 }

4) After successfully acquiring request header response, a parameter called x-subject-token, FIG.

5 ) token will expire , if you see a message prompt return of the expired or Token update required, it must re-generate the token

. 6 ) is a token request requires a lot, usually on the header, the parameter name: X-the Token-the Auth-

7 ) As the token is often used, it is recommended to generate a token of url save link up directly to the next call on it

Author: Huawei cloud MVP Zheng Yongxiang

Guess you like

Origin www.cnblogs.com/huaweicloud/p/11865703.html