# Authentication

This topic will cover:

  • Authentication to API resources.
  • Authentication to MQTT broker.
  1. The authentication method adopts JWT (JSON Web Token) authentication. Please refer to https://jwt.io for more information about JWT format.
  2. You will need your API username and password generated on the API page in your developer account to create JWT token.
  3. There are 2 types of tokens based on their user: developer token and user token.
  4. There are 2 types of tokens based on their functionality: refresh token and access token.
  5. The life span of refresh token is 180 days.
  6. The life span of access token is 12 hours.
  7. Authentication server address is https://iot.samelement.com/auth

The figure below explain how to obtain your developer refresh token and access token:

The figure below explain how to obtain your user refresh token and access token:

The following figure is generally used of access token. For detail please refer to the related API documentation: