Once you create an account, your API credentials may be requested within the Account page. You will see two credentials: the Client ID and the Client Secret.
These two credentials may be exchanged for an access token using the OAuth2 client credentials flow. You will use this access token to fetch map tiles from our microservices. Below is a possible JavaScript implementation of completing this authorization flow.
const clientId = "[Client ID]";
const clientSecret = "[Client Secret]";
fetch("https://auth.clockworkmicro.com/oauth2/token", {
method: "POST",
body:
`grant_type=client_credentials` +
`&client_id=${clientId}` +
`&client_secret=${clientSecret}`,
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
})
.then((res) => {
// Return the response as JSON
return res.json();
})
.then((data) => {
// Success! The access token is available under 'access_token' on the response
console.log("Access token: ", data["access_token"]);
})
.catch((err) => {
// Log any errors
console.log("Something went wrong! ", err);
});