Get access token

https://api.sciener.com/oauth2/token

Cloud APIs grant access by OAuth 2.0 's Resource Owner Password grant type,you have to request with username and password,all the cloud apis should be requested with access token.

Note: The username and password here are the account of the TTLock app. You need to download the TTLock app and register. please do not use your open platform's developer account.

Note:access token returned will expire in seconds of expires_in(Default validity of 90 days),request with expired access token will get 10004 error code,you should get a new token with this API, or Refresh the access token.

1 Request example

POST, ContentType:application/x-www-form-urlencoded

 

2 Request parameters

NameTypeRequiredDescription
clientIdStringYclientId from Create application
clientSecretStringYclientSecret from Create application
usernameStringYusername you used to login TTLock APP,or The prefixed username return by cloud api: User register. Notice:please do not use your open platform's developer account.
passwordStringYPassword(32 chars, low case, md5 encrypted)

3 Response and example

NameTypeRequest parameters
access_tokenStringAccess token
uidIntUser id
expires_inIntExpire time of access token, default validity of 90 days, in second.
refresh_tokenStringRefresh token