Files
doc-exports/docs/taurusdb/api-ref/gaussdb_03_0001.html
wangdengke2 ee9f8aa0b6 taurusdb_api
Reviewed-by: Gladkov, Maksim <mgladkov@noreply.gitea.eco.tsi-dev.otc-service.com>
Co-authored-by: wangdengke2 <wangdengke2@huawei.com>
Co-committed-by: wangdengke2 <wangdengke2@huawei.com>
2025-10-30 15:48:33 +00:00

48 lines
4.4 KiB
HTML

<a name="gaussdb_03_0001"></a><a name="gaussdb_03_0001"></a>
<h1 class="topictitle1">Authentication</h1>
<div id="body1526376873787"><p id="gaussdb_03_0001__p27556670">Token authentication must be performed to call APIs.</p>
<p id="gaussdb_03_0001__p4531593915538">Authentication using tokens: General requests are authenticated using tokens.</p>
<div class="section" id="gaussdb_03_0001__section2417768214391"><h4 class="sectiontitle">Token-based Authentication</h4><div class="note" id="gaussdb_03_0001__note133321911123"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="gaussdb_03_0001__p1254514271026">The validity period of a token is 24 hours. When using a token for authentication, cache it to prevent frequently calling the IAM API used to obtain a user token.</p>
</div></div>
<p id="gaussdb_03_0001__p18703477214">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.</p>
<pre class="screen" id="gaussdb_03_0001__screen1523316215617">{
"auth": {
"identity": {
"methods": [
"password"
],
"password": {
"user": {
"name": "<strong id="gaussdb_03_0001__b523211213611"><em id="gaussdb_03_0001__i152321121768">username</em></strong>",
"password": "<strong id="gaussdb_03_0001__b1423242864"><em id="gaussdb_03_0001__i102321723618">********</em></strong>",
"domain": {
"name": "<strong id="gaussdb_03_0001__b1232182160"><em id="gaussdb_03_0001__i142321521463">domainname</em></strong>"
}
}
}
},
<strong id="gaussdb_03_0001__b172326214617"> "scope": {</strong><strong id="gaussdb_03_0001__b122324215616"> </strong>
<strong id="gaussdb_03_0001__b32321024619"> </strong><strong id="gaussdb_03_0001__b62336216618"> "project": {</strong><strong id="gaussdb_03_0001__b1623362867"> </strong>
<strong id="gaussdb_03_0001__b1423332562"> </strong><strong id="gaussdb_03_0001__b8233162061"> "name": "<em id="gaussdb_03_0001__i6233321063">xxxxxxxx</em>"</strong><strong id="gaussdb_03_0001__b123313217620"> </strong>
<strong id="gaussdb_03_0001__b1423332869"> </strong><strong id="gaussdb_03_0001__b52331822611"> }</strong><strong id="gaussdb_03_0001__b1223313212617"> </strong>
<strong id="gaussdb_03_0001__b182333215616"> </strong><strong id="gaussdb_03_0001__b17233172167"> }</strong><strong id="gaussdb_03_0001__b122332212612"> </strong>
}
}
</pre>
<p id="gaussdb_03_0001__p116169153412">In <a href="gaussdb_03_0005.html">Making an API Request</a>, the process of calling the API used to <a href="https://docs.otc.t-systems.com/en-us/api/iam/en-us_topic_0057845583.html" target="_blank" rel="noopener noreferrer">obtain a user token</a> is described.</p>
<p id="gaussdb_03_0001__p9691122114266">After a token is obtained, add the <strong id="gaussdb_03_0001__b1897020427341">X-Auth-Token</strong> header field must be added to requests to specify the token when calling other APIs. For example, if the token is <span class="parmvalue" id="gaussdb_03_0001__parmvalue1038232518315"><b>ABCDEFJ....</b></span>, <span class="parmvalue" id="gaussdb_03_0001__parmvalue10383725113110"><b>X-Auth-Token: ABCDEFJ....</b></span> can be added to a request as follows:</p>
<div class="codecoloring" codetype="Java" id="gaussdb_03_0001__screen11189101154015"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
<span class="normal">2</span></pre></div></td><td class="code"><div><pre><span></span><span class="n">Content</span><span class="o">-</span><span class="n">Type</span><span class="p">:</span><span class="w"> </span><span class="n">application</span><span class="o">/</span><span class="n">json</span>
<span class="n">X</span><span class="o">-</span><span class="n">Auth</span><span class="o">-</span><span class="n">Token</span><span class="p">:</span><span class="w"> </span><span class="n">ABCDEFJ</span><span class="p">....</span>
</pre></div></td></tr></table></div>
</div>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="gaussdb_03_0000.html">Calling APIs</a></div>
</div>
</div>