Create an access token
curl --request POST \
--url https://connect.laces.run/v1/oauth/token \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data grant_type=client_credentials \
--data 'scope=events:read orders:write'const options = {
method: 'POST',
headers: {
Authorization: 'Basic <encoded-value>',
'Content-Type': 'application/x-www-form-urlencoded'
},
body: new URLSearchParams({grant_type: 'client_credentials', scope: 'events:read orders:write'})
};
fetch('https://connect.laces.run/v1/oauth/token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://connect.laces.run/v1/oauth/token"
payload = {
"grant_type": "client_credentials",
"scope": "events:read orders:write"
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/x-www-form-urlencoded"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://connect.laces.run/v1/oauth/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "grant_type=client_credentials&scope=events%3Aread%20orders%3Awrite",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/x-www-form-urlencoded"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"access_token": "LCSTOK-EXAMPLETKN23456789EXAMPLETKN23456789EXAMPLETKN234567-X",
"token_type": "Bearer",
"expires_in": 3600,
"scope": "events:read orders:write checkout_sessions:write"
}Authentication
Create an access token
Exchange your client id and secret for a one-hour bearer token. Server-side only.
POST
/
oauth
/
token
Create an access token
curl --request POST \
--url https://connect.laces.run/v1/oauth/token \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data grant_type=client_credentials \
--data 'scope=events:read orders:write'const options = {
method: 'POST',
headers: {
Authorization: 'Basic <encoded-value>',
'Content-Type': 'application/x-www-form-urlencoded'
},
body: new URLSearchParams({grant_type: 'client_credentials', scope: 'events:read orders:write'})
};
fetch('https://connect.laces.run/v1/oauth/token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://connect.laces.run/v1/oauth/token"
payload = {
"grant_type": "client_credentials",
"scope": "events:read orders:write"
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/x-www-form-urlencoded"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://connect.laces.run/v1/oauth/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "grant_type=client_credentials&scope=events%3Aread%20orders%3Awrite",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/x-www-form-urlencoded"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"access_token": "LCSTOK-EXAMPLETKN23456789EXAMPLETKN23456789EXAMPLETKN234567-X",
"token_type": "Bearer",
"expires_in": 3600,
"scope": "events:read orders:write checkout_sessions:write"
}Authorizations
Client id as the username, client secret as the password. Token endpoint only. These are live credentials: keep the secret on your server.
Body
application/x-www-form-urlencodedapplication/json
Available options:
client_credentials Space-separated. Omit to get every scope the client holds.
Example:
"events:read orders:write"
Body authentication only (instead of Basic).
Example:
"LCSCLI-EXAMPLECLNT2345EXAMP"
Body authentication only (instead of Basic). Server-side only.
Example:
"LCSSECK-EXAMPLESECRET2345678EXAMPLESECRET2345678EXAMPLESECRE-X"