Call QueryToken to verify the Token.

Scenario

This method is called by the application server. QueryToken To check whether a single Token is valid. For more information, see Overview of token authentication.

Limits

The maximum number of requests per user is 100 per second. For special needs, please submit work Order application.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

ParameterTypeRequiredExampleDescription
ActionStringYesQueryToken

The operation that you want to perform. Value: QueryToken

InstanceIdStringYespost-cn-0pp12gl****

The ID of the MQTT instance, which must match the client-used instance ID. In the console instance details page.

Region IDStringYesmq-internet-access

The region of the message queue for MQTT instance.

TokenStringYesLzMT+XLFl5s/YWJ/MlDz4t/Lq5HC1iGU1P28HAMaxYxn8aQbALNtml7QZKl9L9kPe6LqUb95tEVo+zUqOogs9+jZwDUSzsd4X4qaD3n2TrBEuMOqKkk1Xdrvu9VBQQvIYbz7MJWZDYC3DlW7gLEr33Cuj54iIhagtBi3epStJitsssWs7otY9zhKOSZxhr49G3d0bh35mwyP18EMvDas8UlzeSozsSrujNUqZXOGK0PEBSd+rWMGDJlCt6GFmJgm2JFY7PJwf/7OOSmUYIYFs5o/PuPpoTMF+hcVXMs+0yDukIMTOzG9m3t8k36PVrghFmnK6pC3Rt3mibjW****ng==

The Token that you want to query.

Note For more information about these parameters, see Common parameters and Make API requests.

Response parameters

ParameterTypeExampleDescription
RequestIdString5C8AADD0-6A95-436 D-AFA0-3405CCE36A24

The ID of the request, which is a common parameter. Each request has a unique ID.

TokenStatusBooleanTrue

The status of the Token you have verified. Valid values:

  • True: This Token is valid.
  • False: The Token is invalid.

Examples

Sample requests

http(s)://onsmqtt.cn-hangzhou.aliyuncs.com/? Action=QueryToken
&InstanceId=post-cn-0pp12gl****
&RegionId=mq-internet-access
&Token=LzMT+XLFl5s/YWJ/MlDz4t/Lq5HC1iGU1P28HAMaxYxn8aQbALNtml7QZKl9L9kPe6LqUb95tEVo+zUqOogs9+jZwDUSzsd4X4qaD3n2TrBEuMOqKkk1Xdrvu9VBQQvIYbz7MJWZDYC3DlW7gLEr33Cuj54iIhagtBi3epStJitsssWs7otY9zhKOSZxhr49G3d0bh35mwyP18EMvDas8UlzeSozsSrujNUqZXOGK0PEBSd+rWMGDJlCt6GFmJgm2JFY7PJwf/7OOSmUYIYFs5o/PuPpoTMF+hcVXMs+0yDukIMTOzG9m3t8k36PVrghFmnK6pC3Rt3mibjW****ng==
&<Common request parameters>

Sample success responses

XML format

<QueryTokenResponse>
  <RequestId>5C8AADD0-6A95-436D-AFA0-3405CCE36A24</RequestId>
  <TokenStatus>true</TokenStatus>
</QueryTokenResponse>

JSON format

{
  "RequestId": "5C8AADD0-6A95-436D-AFA0-3405CCE36A24",
  "TokenStatus": true
}

Error codes

HTTP status codeErrorError messageDescription
404ApiNotSupportThe specified API is not supported.The current interface is not supported. Please check.
400CheckAccountInfoFailedAn error occurred while checking the account information by the STS token.An error occurred while parsing the account information in the STS Token.
400InstancePermissionCheckFailedAn error occurred while validating the permissions of the instance. Please verify the account that created the instance and its permissions settings.The error message returned because the instance permission verification fails. Check the ownership and authorization policy of the MQTT instance.
500InternalErrorAn error occurred while processing your request. Try again later.The MQTT backend service is abnormal. Please try again.
400ParameterCheckFailedAn error occurred while validating the parameters. The parameters may be missing or invalid.The parameter verification fails. This parameter may be missing or invalid.
400PermissionCheckFailedAn error occurred while validating the resource permissions. Please check the account that created the instance, topic, and GroupId, and check their permission settings.The error message returned because the resource permission verification failed. Check the instance, Topic, and Group ID for their permissions and authorization policies.
400QueryTokenOverFlowYou have queried tokens too many times. Please try again later.token query is too frequent for system throttling. Try again later.
500SystemOverFlowAn error occurred while processing your request. Please try again.System throttling. Please try again.
400InvalidParameter.%sAn error occurred while validating the parameter. The parameter may be missing or invalid.The parameter verification fails. This parameter may be missing or invalid.

For a list of error codes, visit the API Error Center.