doc-exports/docs/iam/api-ref/en-us_topic_0057845586.html
zhangyue 3b5a58b1fe IAM API 2.0.38
Reviewed-by: gtema <artem.goncharov@gmail.com>
Co-authored-by: zhangyue <zhangyue164@huawei.com>
Co-committed-by: zhangyue <zhangyue164@huawei.com>
2022-10-26 04:31:24 +00:00

85 lines
6.5 KiB
HTML

<a name="en-us_topic_0057845586"></a><a name="en-us_topic_0057845586"></a>
<h1 class="topictitle1">Verifying a Token</h1>
<div id="body1602765747314"><div class="section" id="en-us_topic_0057845586__section757173854518"><h4 class="sectiontitle">Function</h4><p id="en-us_topic_0057845586__p131681838174514">This API can be used by the administrator to verify the token of a user or used by a user to verify their token. The administrator can only verify the token of a user created using the account. If the verified token is valid, <strong id="en-us_topic_0057845586__b3961122204317">200</strong> is displayed.</p>
</div>
<div class="section" id="en-us_topic_0057845586__section166083812459"><h4 class="sectiontitle">URI</h4><p id="en-us_topic_0057845586__p316853874510">HEAD /v3/auth/tokens</p>
</div>
<div class="section" id="en-us_topic_0057845586__section1360123815455"><h4 class="sectiontitle">Request Parameters</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="en-us_topic_0057845586__table1961138104518" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Parameters in the request header</caption><thead align="left"><tr id="en-us_topic_0057845586__row71681738124513"><th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.3.2.2.5.1.1"><p id="en-us_topic_0057845586__p1316814388458">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="10%" id="mcps1.3.3.2.2.5.1.2"><p id="en-us_topic_0057845586__p21681838174512">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.3.2.2.5.1.3"><p id="en-us_topic_0057845586__p1816893844518">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.3.2.2.5.1.4"><p id="en-us_topic_0057845586__p14168538184512">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="en-us_topic_0057845586__row8168193813457"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.2.5.1.1 "><p id="en-us_topic_0057845586__p1916843834516">X-Auth-Token</p>
</td>
<td class="cellrowborder" valign="top" width="10%" headers="mcps1.3.3.2.2.5.1.2 "><p id="en-us_topic_0057845586__p51681538124520">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.2.5.1.3 "><p id="en-us_topic_0057845586__p316813854516">String</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.3.2.2.5.1.4 "><ul id="en-us_topic_0057845586__ul1963814299291"><li id="en-us_topic_0057845586__li176391829162917">To verify your own token, specify your token. There are no special requirements on the permissions that your token must have.</li><li id="en-us_topic_0057845586__li11639192962916">To verify the token of another user under the same domain, use a token that has permissions of the <strong id="en-us_topic_0057845586__b2069775420254">Security Administrator</strong> policy.</li></ul>
</td>
</tr>
<tr id="en-us_topic_0057845586__row21687383455"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.2.5.1.1 "><p id="en-us_topic_0057845586__p1016893884514">X-Subject-Token</p>
</td>
<td class="cellrowborder" valign="top" width="10%" headers="mcps1.3.3.2.2.5.1.2 "><p id="en-us_topic_0057845586__p1116833813459">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.2.5.1.3 "><p id="en-us_topic_0057845586__p181681387457">String</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.3.2.2.5.1.4 "><p id="en-us_topic_0057845586__p19168638114520">Token to be verified.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="en-us_topic_0057845586__section1371238114514"><h4 class="sectiontitle">Response Parameters</h4><p id="en-us_topic_0057845586__p181680389451">None</p>
</div>
<div class="section" id="en-us_topic_0057845586__section7722384454"><h4 class="sectiontitle">Example Request</h4><pre class="screen" id="en-us_topic_0057845586__screen201688383457">curl -i -k -H "X-Auth-Token:$token" -H "X-Subject-Token:$token" -X HEAD https://sample.domain.com/v3/auth/tokens</pre>
</div>
<div class="section" id="en-us_topic_0057845586__section77303810458"><h4 class="sectiontitle">Example Response</h4><p id="en-us_topic_0057845586__p1916813384455">None</p>
</div>
<div class="section" id="en-us_topic_0057845586__section074113864511"><h4 class="sectiontitle">Status Codes</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="en-us_topic_0057845586__table774238124510" frame="border" border="1" rules="all"><thead align="left"><tr id="en-us_topic_0057845586__row13168138134517"><th align="left" class="cellrowborder" valign="top" width="15%" id="mcps1.3.7.2.1.3.1.1"><p id="en-us_topic_0057845586__p1616933812456">Status Code</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="85%" id="mcps1.3.7.2.1.3.1.2"><p id="en-us_topic_0057845586__p18169113812459">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="en-us_topic_0057845586__row101691338164515"><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.7.2.1.3.1.1 "><p id="en-us_topic_0057845586__p316983814512">200</p>
</td>
<td class="cellrowborder" valign="top" width="85%" headers="mcps1.3.7.2.1.3.1.2 "><p id="en-us_topic_0057845586__p9561111611495">The request is successful.</p>
</td>
</tr>
<tr id="en-us_topic_0057845586__row201691638124510"><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.7.2.1.3.1.1 "><p id="en-us_topic_0057845586__p3169183854511">401</p>
</td>
<td class="cellrowborder" valign="top" width="85%" headers="mcps1.3.7.2.1.3.1.2 "><p id="en-us_topic_0057845586__p19371432154917">Authentication failed.</p>
</td>
</tr>
<tr id="en-us_topic_0057845586__row616933834519"><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.7.2.1.3.1.1 "><p id="en-us_topic_0057845586__p1816923834511">404</p>
</td>
<td class="cellrowborder" valign="top" width="85%" headers="mcps1.3.7.2.1.3.1.2 "><p id="en-us_topic_0057845586__p1939913256494">The requested resource cannot be found.</p>
</td>
</tr>
<tr id="en-us_topic_0057845586__row41699388458"><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.7.2.1.3.1.1 "><p id="en-us_topic_0057845586__p14169133816453">500</p>
</td>
<td class="cellrowborder" valign="top" width="85%" headers="mcps1.3.7.2.1.3.1.2 "><p id="en-us_topic_0057845586__p31698384455">The system is abnormal.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="en-us_topic_0057845626.html">Token Management</a></div>
</div>
</div>