Authenticate with Application Tokens
To retrieve the necessary authentication token to use the Telecom Liechtenstein API, you must use an application token generated in your Telecom Liechtenstein account.
Application tokens are recommended for M2M communications as this doesn’t involve leaving user credentials on an application server or devices with programmatic API access. Other advantages of application tokens are that you can create multiple tokens, restrict their use to a specific IP address range or application, and configure an expiration date, after which the token is automatically revoked. Application tokens can also be revoked at any time on a per-token basis.
Create an Application Token
You can create an application_token
via POST request to /api/v1/application_token
.
POST https://smartsim.telecom.li/api/v1/application_token
Request header
Authorization: Bearer kNTktNTA1My00YzdhLT...
Request body
{
"description": "Token with expiry date",
"expiry_date": "2021-05-29"
}
Response
{
"application_token": "KAOp24TuMgjO2FpZmZ3ZFjSqpk7ea_mY8..."
}
The application token can be revoked at any time.
Tip: You can also create and view application tokens in the emnify Portal. For step-by-step instructions, see Application tokens in the emnify Documentation.
Authenticate with an Application Token
Once you create an application token, use /api/v1/authenticate
to generate a JSON Web Token (JWT) auth_token
that authenticates subsequent API calls.
POST https://smartsim.telecom.li/api/v1/authenticate
Request body
{
"application_token": "kNTktNTA1My00YzdhLT..."
}
Response
{
"auth_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
Note: The server only returns an auth_token
There’s no refresh_token
included in the response.