Get a Token

Last Updated on : 2023-06-15 04:54:24

In the cloud-to-cloud integration scenarios, you can request cloud API authorizations from the platform in simple mode and get a token implicitly.

Prerequisites

Please read these documents carefully before making API requests.
Quick Start
API Sample Request

API address

GET: /v1.0/token

Request parameter

Parameter nameTypeINRequiredDescription
reqTokenReqquerytrueThe API request.

Description of req

Parameter nameTypeINRequiredDescription
grant_typeString trueThe authorization type. Valid values:
  • 1: simple mode.
  • 2: license mode.
codeString falseThe license code. It is available only when the value of grant_type is 2.
terminal_idString falseThe terminal ID.

Return parameter

Parameter nameTypeDescription
resultTokenResThe returned result.

Description of result

Parameter nameTypeDescription
access_tokenStringThe access token.
expire_timeIntegerThe validity period in seconds.
refresh_tokenStringThe refresh token.
uidStringTuya user ID.

Request example

GET: /v1.0/token?grant_type=1

Return example

{
    "expire_time": 7200,
    "access_token": "**",
    "uid": "eu*****",
    "refresh_token": "**"
}

Error code

For more information, see error code.