Search K
Appearance
Appearance
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.
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
Login and receive an access token for future requests.
Optionally receive a refresh token for future access token generation.
curl -X POST http://localhost:8080/v2/users/login
fetch("http://localhost:8080/v2/users/login", { method: "POST" })
.then(response => response.json())
.then(data => console.log(data));
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://localhost:8080/v2/users/login");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
import requests
response = requests.post("http://localhost:8080/v2/users/login")
print(response.json())
Refresh the access token and refresh token that was retrieved during login.
curl -X POST http://localhost:8080/v2/users/refreshToken
fetch("http://localhost:8080/v2/users/refreshToken", { method: "POST" })
.then(response => response.json())
.then(data => console.log(data));
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://localhost:8080/v2/users/refreshToken");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
import requests
response = requests.post("http://localhost:8080/v2/users/refreshToken")
print(response.json())
Related objects to include in the response. See the description of return value for more details.
curl -X POST https://api.lightbug.cloud/api/users/login
fetch("https://api.lightbug.cloud/api/users/login", { method: "POST" })
.then(response => response.json())
.then(data => console.log(data));
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.lightbug.cloud/api/users/login");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
import requests
response = requests.post("https://api.lightbug.cloud/api/users/login")
print(response.json())