Auth

Generate access token

Work with tokens.Generate new access token by authentication data.

Attention

When auth_type is admin and two-factor authentication is enabled you should pass one of these attributes: code or fingerprint. You can check two-factor authentication status with this request.

Required attributes by authentication type:

admincustomerapi_keysession
login++
password++
key+
signature+
nonce+
session_id+
code*
fingerprint*

Labels description:

  • + Always required.

  • * One of these attributes is required when two-factor authentication is enabled.

Possible errors

  • INVALID_TWO_FACTOR_CODE - Invalid two-factor code or fingerprint.

  • MISSED_TWO_FACTOR_CODE - Missed required two-factor code or fingerprint.

  • INVALID_AUTH_TYPE - Invalid authentication type. Allowed types: admin, customer, api_key or session.

post/admin/auth/tokens

Request

  • Base URL: https://demo.splynx.com/api/2.0
  • URL: https://demo.splynx.com/api/2.0/admin/auth/tokens
  • Auth: HTTP basic

Request body

auth_type'admin' | 'customer' | 'api_key' | 'session' required

Authorization type

loginstring

Admin or customer login. Required for auth types: admin, customer.

passwordstring

Admin or customer password. Required for auth types: admin, customer.

keystring

API key. Required for auth type api_key.

secretstring

API secret. Required for auth type api_key.

session_idstring

Splynx session id. Required for auth type session.

codestring

Two factor code. Can be used only with auth type admin when two factor authentication is enabled.

fingerprintstring

The fingerprint of the trusted device. Can be used only with auth type admin when two factor authentication is enabled. This fingerprint returns when you add a trusted device.

Example request

{
  "auth_type": "customer",
  "login": "bob",
  "password": "hard_password"
}

Response

access_tokenstring

Access token. Contains user information

access_token_expirationnumber

Access token expiration timestamp

refresh_tokenstring

Refresh token

refresh_token_expirationnumber

Refresh token expiration timestamp

permissionsstring[]

Token permissions

Example response

{
  "access_token": "2dbf3280cf9sb3b8a7c15201c76b9s1",
  "access_token_expiration": 1542493076,
  "refresh_token": "caebf3980cf9fb3b8c7c15501c77b980",
  "refresh_token_expiration": 1578673076,
  "permissions": []
}

Changes

No recorded changes to this operation across all 1 revision of this API.