An access token is a credential for authenticating requests to the Intelligent Speech Interaction API. This topic describes how to obtain a token and provides answers to frequently asked questions.
Scenarios
Obtaining a token | Recommended scenario |
For testing purposes only. You can obtain the token from the console. | |
Recommended for production environments. You can pass the AccessKey ID and AccessKey secret to periodically and automatically obtain a token using code in the software development kit (SDK). | |
Recommended if an SDK is not available for your programming language or to manage dependent components. You can obtain a token using OpenAPI. |
FAQ
How do I resolve the "'status': 40020105, 'message': 'Meta:APPKEY_NOT_EXIST:Appkey not exist'" error that occurs when I call the service after obtaining a token?
This error indicates that the AppKey does not exist.
Confirm that the AppKey exists. If you are using a RAM user, confirm that the RAM user is granted the required permissions. Then, confirm that the AppKey, AccessKey, and token belong to the same account.
If you are using an Alibaba Cloud account, as indicated by Alibaba Cloud account, verify that the AppKey, AccessKey, and the generated token belong to the same account.

If you are using a RAM user, as indicated by RAM user, confirm that the NLS-related permissions are granted to the RAM user. Then, verify that the AppKey, AccessKey, and the generated token belong to the same account.


How do I resolve the "ErrCode 40020503" error that occurs when I obtain a token?
The 40020503 error indicates that the RAM user does not have permissions on the voice API. You can go to the Resource Access Management (RAM) console to grant the AliyunNLSFullAccess permission to the RAM user. For more information, see Manage the permissions of a RAM user.
How do I resolve the "403 Forbidden" error that is returned when I call a voice API?
The 403 error indicates that the token has expired or is invalid.
Perform the following steps:
Confirm that the token is entered correctly.
Confirm that the token has not expired. If it has expired, you must obtain a new one.
How do I resolve the issue where an empty value or "null" is returned when I obtain a token?
Go to the AccessKey Management page and confirm that the AccessKey ID and AccessKey secret are correct.
Confirm that Intelligent Speech Interaction is activated. If it is not, go to the console to activate the service.
If you are using a RAM user, confirm that the AliyunNLSFullAccess permission is granted to the RAM user.
Confirm that you have not modified the system time. A discrepancy between the system time and the actual time can cause this issue.
How do I resolve the "ErrMsg: 'No permission!'" error that occurs when I obtain a token?
This error indicates that you do not have the required permissions.
If you are using a RAM user, confirm that the AliyunNLSFullAccess permission is granted to the RAM user. For more information, see Create an account.
Can I obtain a long-term token?
For security reasons, Intelligent Speech Interaction does not provide long-term tokens.
How do I use code in an SDK to get the expiration time of a token? Why is the returned value 1657132052 converted to 1970-01-20 12:18:52?
The validity period of a token can be retrieved from the ExpireTime parameter in the server-side response message. This value is a UNIX timestamp in seconds.
How do I resolve the "connect failed" error that indicates a network is unreachable when I fail to obtain a token?
Confirm that the AppKey, token, and URL are correct.
Check your network connection. Connection errors are usually caused by network issues. You can ping the domain name or use telnet commands to check network connectivity.
How do I resolve the "Server unreachable: java.net.ConnectException: Connection refused" error that occurs when I obtain a token?
This error indicates that the network connection was refused. You can ping the domain name or use telnet commands to check network connectivity. If the connection fails, check your network settings.
How do I resolve a token acquisition failure in Postman caused by an incorrect time zone?
You can change the time zone to China Standard Time, which is UTC+8.
Does re-obtaining a token invalidate an existing token?
No, it does not. Re-obtaining a token does not affect the validity of an existing token. The validity depends only on time. The validity period of a token can be retrieved from the ExpireTime parameter in the server-side response message.
How can multiple devices share a valid token?
The same token can be reused as long as it is valid.
How do I obtain a token using an HTTP interface without using an SDK? How do I construct the parameters and signature for the request?
For more information, see Obtain a token using OpenAPI.
When I obtain a token using OpenAPI, can I use a repeated UUID if the SignatureNonce parameter remains unchanged?
For more information, see Obtain a token using OpenAPI.
How do I resolve the "Specified signature is not matched with our calculation" error when I obtain a token using OpenAPI?
For more information, see Obtain a token using OpenAPI.
When I obtain a token using an SDK, the operation fails if the system time is not standard. Can I set a custom timestamp in the SDK instead of using the system time?
No, you cannot. The token must be generated based on the system time.
Is there a time limit for a token?
Time-limited:
A token obtained from the console is valid for 24 hours.
For a token obtained using an SDK or OpenAPI, you can view its expiration timestamp in the
ExpireTimefield. The value is a UNIX timestamp in seconds. For example, the timestamp 1527592757 corresponds to 19:19:17 on May 29, 2018 (UTC+8). This means the token is valid until this time. If the token expires, you must obtain a new one.
Is there a limit on the number of times I can obtain a token?
Unlimited.