Authorized Login by Ticket

Last Updated on : 2023-06-21 07:13:09

Based on the callback address provided by the business user, Tuya gets the information about a specified consumer through the ticket and authorizes the consumer to log in to the Tuya system.

API address

POST: /v1.0/iot-01/{schema}/ticket/users

Request parameter

Parameter nameTypeINRequiredDescription
reqThirdTicketLoginReq falseThe request for authorized login by ticket.

Description of req

Parameter nameTypeINRequiredDescription
ticketStringqueryfalseThe third-party ticket.
schemaStringurifalseThe schema of a specified app.

Return parameter

Parameter nameTypeDescription
resultUserOAuth2TokenVOThe returned result.

Description of result

Parameter nameTypeDescription
access_tokenStringThe access token.
expire_timeIntegerThe time when a token expires.
refresh_tokenStringThe refresh token.
uidStringThe user ID.

Request example

POST: /v1.0/iot-01/{schema}/ticket/users
{
  "ticket": "sajsxxxxxaksishh",
  "schema": "xyxxxxxxxx281iu"
}

Return example

{
    "expire_time": 3600,
    "access_token": "oQnCsxxxxxx282jx",
    "refresh_token": "wWuxdksxxxx28Uwn",
    "uid": "ay28129xxxxxxx2821"
}

Error code

For more information, see error code.