هذه الصفحة غير متوفرة حاليًا بلغتك المحلية. نحن نعمل جاهدين على إضافة المزيد من اللغات. شاكرين تفهمك ودعمك المستمر لنا.
- What's New
- Function Overview
- Product Bulletin
- Service Overview
-
Billing
- Billing Overview
- Billing Modes
- Billing Items
- Billing Examples
- Billing Mode Changes
- Renewing Subscriptions
- Bills
- Arrears
- Billing Termination
- Cost Management
-
Billing FAQ
- Why Do I Get Additional Charges or Arrears After Purchasing a Package?
- Why Can I Still Call the Service and Incur Arrears When My Account Balance Is Zero?
- Why Do I Get Additional Charges or Arrears After Unsubscribing from an OCR Service?
- Can I Refund a Package After I Buy It?
- How Is Billing Handled When a Package Is Used Up? And How Can I Check the Remaining Quota and Receive Alerts for My Package?
- How Does a Member Account Use a Package Purchased by an Enterprise Master Account?
- What Is Fee Deduction Order for Multiple Packages?
- What are Grace Period and Retention Period?
- What Is Considered Valid Billing for OCR?
- Can Different API Packages Be Shared?
- Can OCR Be Charged by Project?
- Getting Started
- User Guide
- SDK Reference
- API Reference
-
FAQs
- Subscription
-
Token-based Authentication
- What Are the Username, Domain Name, and Project Name in the Token Message Body?
- Why Is the Error Message "The account is locked." Displayed?
- Why Is the Error Message "The username or password is wrong." Displayed?
- Why Does the Token Retrieval Process Return a 401 Status Code?
- Why Does the Token Fail to Be Obtained When I Use Postman to Call an ORC API?
- Why Don't I Have Programming Access Permissions?
- Why Does the Header Overflow When I Use Postman to Call an OCR API?
-
API
- How Do I View the API Usage?
- Why Is the Actual Number of API Calls Inconsistent with the Record Displayed on the Management Console?
- Does OCR Support Batch Processing?
- Can the OCR Results Be Converted into Word, TXT, or PDF Files?
- How Do I Obtain the Base64 Code of an Image?
- What Is the Number of Concurrent OCR API Calls?
- How Do I Use OCR APIs?
- Can the Region Where OCR Is Called Be Different from the Region Where OBS Resources Are Located?
- Can the Input Data of OCR Be Stored Locally?
- How Do I Improve the Recognition Speed?
- How Do I Convert a PDF to an Image?
- Can OCR Read Images from Non-Huawei Cloud Storage?
-
SDK
- Do OCR SDKs Need to Be Purchased?
- Do OCR SDKs Need Maven to Manage Dependency Packages?
- How Do I Change the Response Type in Returned Results?
- How Can I Fix an SSL Configuration Error?
- How Can I Fix a "connect timed out" Error?
- Why Does the Project ID Fail to Be Obtained?
- What Should I Do if I Forget My AK and SK?
-
Error Code
- Why Do I Fail to Call an OCR API?
- How Do I Handle the Error APIG.0301?
- How Do I Handle the Error APIG.0201?
- How Do I Handle the Error APIG.0101?
- How Do I Handle the Error APIG.0106?
- How Do I Handle the Error APIG.0308?
- How Do I Handle the Error ModelArts.0212?
- How Do I Handle the Error ModelArts.4603 or ModelArts.4704?
- How Do I Handle the Error ModelArts.4204?
- Permissions
- Data Security and Privacy
- Regions and AZs
- General Consulting
- Videos
- Glossary
- More Documents
- General Reference
Copied.
Authentication
Requests for calling an API can be authenticated using either of the following methods:
- Token-based authentication: Requests are authenticated using a token.
Call APIs using endpoints and tokens. Object Storage Service (OBS), Data Ingestion Service (DIS), Natural Language Processing (NLP), Optical Character Recognition (OCR), and Image Recognition in the UAE-Abu Dhabi -OP5 region cannot be called.
- AK/SK-based authentication: Requests are authenticated by encrypting the request body using an AK/SK pair.
CAUTION:
To call Object Storage Service (OBS), Data Ingestion Service (DIS), Natural Language Processing (NLP), Optical Character Recognition (OCR), or Image Recognition in the UAE-Abu Dhabi region, you need to create a user and generate an AK/SK. Then, call the corresponding API through AK/SK authentication and endpoint. For details about endpoints, visit https://docs.g42cloud.com/en-us/endpoint/index.html. For details about how to obtain the AK/SK for the UAE-Abu Dhabi region, see How Do I Obtain an Access Key (AK/SK) in the ME-Abu Dhabi-OP5 Region?.
Token-based Authentication
A token specifies temporary permissions in a computer system. During API authentication using a token, the token is added to a request to get permissions for calling the API.
- A token is valid for 24 hours. When using a token for authentication, cache it to avoid frequent calling.
When calling the API to obtain a user token, you must set auth.scope in the request body to project.
username indicates the IAM username, domainname indicates the account name, ******** indicates the login password, and project name indicates the project name.
POST https://iam.ae-ad-1.g42cloud.com/v3/auth/tokens Content-Type: application/json { "auth": { "identity": { "methods": [ "password" ], "password": { "user": { "name": "username", //IAM username "password": "********", //Password "domain": { "name": "domainname" //Account name } } } }, "scope": { "project": { "name": "project name" //Replace project name with the actual project name. } } } }
As shown in the following figure, x-subject-token in the response header is the desired user token. This token can then be used to authenticate the calling of OCR APIs.

AK/SK-based Authentication
AK/SK-based authentication supports API requests with a body less than or equal to 12 MB. For API requests with a larger body, perform token-based authentication.
In AK/SK-based authentication, AK/SK is used to sign requests and the signature is then added to the requests for authentication.
- AK: access key ID, which is a unique identifier used in conjunction with a secret access key to sign requests cryptographically.
- SK: secret access key used in conjunction with an AK to sign requests cryptographically. It identifies a request sender and prevents the request from being modified.
In AK/SK-based authentication, you can use the AK/SK to sign requests based on the signature algorithm or use a dedicated signing SDK to sign requests. For details about how to sign requests and use the signing SDK, see API Request Signing Guide.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot