Generate Access Token

  1. The API call you need to make to generate the access token will look like this:

    URL:

    [base_url]/api/locations/{location_id}/access_token
    • Replace [base_url] with the actual base URL provided by SoftPoint.
    • Replace [location_id] with the ID of the specific location provided by SoftPoint
  2. Parameters

    To make the request, you'll need to pass two pieces of information:

    1.- api_key: This is your unique key provided by the API.

    2.- client: This represents the client ID associated with your application.

  3. Send the request.

    ❗️

    The following API call must be performed on the back-end side. Here is on front end code just for demonstration purposes.

    async function fetchAccessToken() {
    const url = 'base_url' + locationId +
    '/access_token';
    const params = {
    api_key: 'your_api_key',
    client: 'your_client_id'
    };
    const requestOptions = {
    method: 'POST',
    headers: {
    'Content-Type': 'application/json',
    },
    body: JSON.stringify(params),
    };
    const res = fetch(url, requestOptions)
    .then(response => response.json())
    .then(data => {
    const accessToken = data.accessToken;
    return accessToken;
    })
    .catch(error => console.error('Error:', error));
    return res;
    }

What’s Next