doc-exports/docs/ocr/api-ref/ocr_03_0005.html
Sheng, Lichang f0fbeaa320 OCR api 20240111 v2
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com>
Co-authored-by: Sheng, Lichang <lichangsheng1@noreply.gitea.eco.tsi-dev.otc-service.com>
Co-committed-by: Sheng, Lichang <lichangsheng1@noreply.gitea.eco.tsi-dev.otc-service.com>
2024-01-17 10:01:47 +00:00

42 lines
2.4 KiB
HTML

<a name="ocr_03_0005"></a><a name="ocr_03_0005"></a>
<h1 class="topictitle1">Authentication</h1>
<div id="body0000001744342617"><div class="section" id="ocr_03_0005__section1996818197218"><h4 class="sectiontitle">Token-based Authentication</h4><div class="note" id="ocr_03_0005__note1183014416217"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="ocr_03_0005__p583113411825">A token is valid for 24 hours. When using a token for authentication, cache it to prevent frequently calling the IAM API.</p>
</div></div>
<p id="ocr_03_0005__p53215201827">A token is used to acquire temporary permissions. During API authentication using a token, the token is added to a request to get permissions for calling the API.</p>
<p id="ocr_03_0005__p132511114102811">To call an API to obtain a user token, you need to set <strong id="ocr_03_0005__b1539222153518">auth.scope</strong> to <strong id="ocr_03_0005__b1849733010353">project</strong> in the request body.</p>
<pre class="screen" id="ocr_03_0005__screen1032142018210">{
"auth": {
"identity": {
"methods": [
"password"
],
"password": {
"user": {
"name": "<em id="ocr_03_0005__i8325207217">user_name</em>",
"password": "********",
"domain": {
"name": "<em id="ocr_03_0005__i93252019213">domain_name</em>"
}
}
}
},
"scope": {
"project": {
"name": "xxxxxxxx"
}
}
}
}</pre>
<p id="ocr_03_0005__p53292011214">After a token is obtained, the <strong id="ocr_03_0005__b2028314204334">X-Auth-Token</strong> header must be added to requests to specify the token when calling other APIs. For example, if the token is <strong id="ocr_03_0005__b11671162403317">ABCDEFJ....</strong>, add <strong id="ocr_03_0005__b19671824113315">X-Auth-Token: ABCDEFJ....</strong> to a request as follows:</p>
<pre class="screen" id="ocr_03_0005__screen032320326">Content-Type: application/json
<strong id="ocr_03_0005__b183212203211">X-Auth-Token: ABCDEFJ....</strong></pre>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="ocr_03_0001.html">API Calling</a></div>
</div>
</div>