Performing Third-Party Request Authentication (applyToken)
Scenario
This API is invoked to generate a client access token for a third-party request.
When other web client APIs request the AICC service, the request header must contain the token. For details about the fields in the request header, see the request header parameter table of the corresponding API.
Method
POST
URI
https://Domain name/apiaccess/ccmessaging/applyToken (For example, the domain name is service.besclouds.com.)
Request Description
No. |
Parameter |
Type |
Mandatory or Not |
Description |
---|---|---|---|---|
1 |
x-app-key |
String |
Yes |
App key, which is the user ID and is configured on the API Fabric |
2 |
Authorization |
String |
Yes |
Authentication field. The format is Bearer {Value of AccessToken returned by the tokenByAkSk interface}. (A space is required after Bearer.) |
No. |
Parameter |
Type |
Mandatory or Not |
Description |
---|---|---|---|---|
1 |
reqBody |
Yes |
Request body |
No. |
Parameter |
Type |
Mandatory or Not |
Description |
---|---|---|---|---|
1.1 |
userId |
String |
Yes |
User ID The value is defined by the enterprise and is a string of 1 to 32 characters. |
1.2 |
userName |
String |
Yes |
Username The value is defined by the enterprise. This parameter is used for name display. |
1.3 |
channelId |
String |
Yes |
Channel ID The value is the same as that of Configuration ID of the channel configured on the Service Channel Configuration > Channel Configuration page in the AICC. |
1.4 |
locale |
String |
Yes |
Language information The value does not contain the country code. For example, zh indicates Chinese, and en indicates English. For details, see ISO 639 language codes. |
Response Description
- Status code: 200
Table 4 applyTokenRspBody parameters No.
Parameter
Type
Description
1.1
token
String
Generated token. When another request is initiated later, the value of this parameter must be assigned to ccmessaging-token in the header.
Notes:
- The token is valid within 1 hour. If the system returns error code 401 (the authentication fails), you need to use the applyToken interface to generate a token again.
- If the token expires during a session, the AICC automatically returns a new token for the current request. The enterprise needs to update the value of ccmessaging-token in the header.
1.2
resultCode
String
Result code
- 0: success
- 1: failure
1.3
resultDesc
String
Result description
Currently, no value is returned.
- Status code: 400
Incorrect request. Check the request path and parameters.
- Status code: 401
Unauthorized operation. 1. Check whether you have purchased related services. 2. Contact customer service to check the status of your account.
- Status code: 404
The requested content is not found. Check the request path.
- Status code: 500
Business failure. Check the values of parameters in the request.
Error Codes
None
Example
- Scenario: Perform third-party request authentication.
- Request header
X-APP-Key: b*************c7b Authorization: Bearer 1fea*************1d6a15 Content-Type: application/json
- Request parameters
{ "userId": "XXXXXXXXX", "userName": "XXXXXXXX", "channelId": "XXXXXXXXXXXX", "locale": "zh" }
- Response parameters
{ "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" }
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