Skip to content

Authentication

Authentication for the Lightbug APIs make use of Bearer tokens in the Authorization header.

API calls that require authentication must have a bearer token submitted as part of the request.

sh
curl -X GET "https://api.lightbug.cloud/apiEndpoint" -H "Authorization: <token>"'

Tokens can be generated from both the v1 and v2 REST APIs, and tokens from either API can be used to authenticate requests to either API.

Tokens might look something like this:

  • aLB1MKbtxLBb02A0fLFUwJ2nLBMaEFeo8ZLB0gHNCTYIGTJ12oBLB0FMlLBjAlLB
  • xLBJhbGciOiJIUzILBiIsILBhjd76IkpXCJ9.eyJle2hs0cy3MjMwMjk1OTjkdhcmcyI6ImdnIiwianRpIjoiZ0luLXNhN3BWYjFTNnhOZFAkchdy2kF2RzlFYzhfV0hlVnJUFUQ0QjN4X3BrbLBvcFh2VUMtX2poM0d0cVlkZ2dvVUUxZ3k0ckg4YTJPNDFxVW8PdUw4OHNPR2hQlkjdbxpWMjU5UE1vb3N5bVFHbmxibW1iYlZRYkNuN2tnRUllTLBLSksyNlNEOEpqbW1qSS15ZjBJSnZHU3NCeWhBekN3R1dwTXhoLBFrcE9VbS1lVkxTb1pwYUlhWkhkQlVycWtlUi1aNE55SnF4SEg4ZmpUaGw1bE81aHZFNVY1lkg890FCTk85anZjMlRRcGdiUGN0dGNazsdfyzBGOFdzIiwibmFtZSI6ImFkYW1AbGllkHRidWcuaW8iLCJzdWIiOjM4MDh9.LBpcVEbm0sywbcPScTg9j54SxdNydJuC_vncrh-fDps

Version 2

Login

POST
/users/login

Login and receive an access token for future requests.
Optionally receive a refresh token for future access token generation.

Request Body

JSON
{
"password": "string",
"refreshable": 0,
"username": "string"
}

Responses

OK
application/json
JSON
{
"expiry": "string",
"refreshToken": "string",
"refreshTokenExpiry": "string",
"token": "string",
"userId": 0
}

Samples

Refresh token

POST
/users/refreshToken

Refresh the access token and refresh token that was retrieved during login.

Request Body

JSON
{
"accessToken": "string",
"refreshToken": "string",
"refreshable": 0
}

Responses

OK
application/json
JSON
{
"expiry": "string",
"refreshToken": "string",
"refreshTokenExpiry": "string",
"token": "string",
"userId": 0
}

Samples

Version 1

Login

POST
/users/login

Parameters

Query Parameters

include

Related objects to include in the response. See the description of return value for more details.

Typestring
formatJSON

Request Body

JSON
{
"username": "string",
"password": "string"
}

Responses

Body (JSON)
application/json
JSON
{
"id": "string",
"ttl": 1209600,
"scopes": [
"string"
],
"created": "string",
"userId": 0
}

Samples