Why Does the Token Retrieval Process Return a 401 Status Code?
There are several reasons.
- A token is valid for 24 hours. If you receive a 401 status code when calling the OCR service using a token, it means that the token has expired. To continue using the OCR service, you should obtain a new token.
The retry mechanism has been configured in the OCR SDK to update the token. If the token is invalid and status code 401 is returned, the OCR SDK sends a request to obtain a token again.
For details about how to use Python to obtain a token again when the existing one has expired, see the HWOcrClientToken.py code in the SDK(Python) file.
- Your IAM username matches the master account name. For security reasons, the token for this account is restricted and cannot be used to ensure the safety of your assets. You are advised to create a new IAM user with a different name and grant it the necessary permissions before proceeding with any related operations. For details, see Creating an IAM User and Assigning Permissions to IAM Users.
- You have recently changed your password, subscribed to a new service, or modified your permissions. As a result, your token may have become invalid. You will need to obtain a new token in this case.
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