# Authentication

We use OAuth2 authentication, here's how to retrieve an M2M access token. These tokens can be used with our [two public facing APIs](https://developer.laurel.ai/guides/public-api-endpoints):

* Time Service
* Identity Service

## Getting Started

Our team will provide you with the following:

* Your customerId
* Your application clientId
* Your application clientSecret
* Your regional API endpoint for our Time Service

## Retrieving API Credentials

With the clientId and clientSecret you can call our token exchange endpoint to generate an M2M access token.

Here's a sample request:

```
POST https://identity.laurel.ai/api/v1/oauth/token

{
    "audience": "https://timeautomation.com",
    "grant_type": "client_credentials",
    "client_id": "<clientId>",
    "client_secret": "<clientSecret>"
}
```

```
Here's a sample response:

{
    "access_token": "<token>",
    "expires_in": 86400,
    "token_type": "Bearer"
}
```

The returned token can be used with your specific `customerId` in Time Service and Identity Service


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developer.laurel.ai/guides/authentication.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
