---
# System prepended metadata

title: Untitled

---

### Authenticating with `core-endpoint`

In order to make authenticated requests with `core-endpoint`, an Authorization header with a valid access token should be provided in the header of the request. For example

```ts
headers: {
  Authorization: 'bearer <access_token>'
}
```

To get an access token for Machine-to-machine communication, a [Client Credentials grant](https://auth0.com/docs/api-auth/tutorials/client-credentials) must be performed. This involves making the following request.

```js
var request = require("request");

var options = {
  method: "POST",
  url: "https://supplypike.auth0.com/oauth/token",
  headers: {
    "content-type": "application/json"
  },
  body: {
    audience: "integrations-scheduler-api",
    client_id: "mH55xymGM20El9EYjrEyjEfrZWrZrxmc",
    client_secret:
      "<client-secret",
    grant_type: "client_credentials"
  },
  json: true
};

request(options, function(error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
```

The response body will contain the access token needed for authentication.

Example response:

```json
{
    "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6Ik16QkRPVEl5UWpnM1JUSTFRVVEwT0RkRk1VTkZPVUZDTlRVMlFqWkNSREF3TURjM1FUUkZNQSJ9.eyJpc3MiOiJodHRwczovL3N1cHBseXBpa2UuYXV0aDAuY29tLyIsInN1YiI6Im1INTV4eW1HTTIwRWw5RVlqckV5akVmclpXclpyeG1jQGNsaWVudHMiLCJhdWQiOiJpbnRlZ3JhdGlvbnMtc2NoZWR1bGVyLWFwaSIsImlhdCI6MTU2OTQzOTA2MCwiZXhwIjoxNTY5NTI1NDYwLCJhenAiOiJtSDU1eHltR00yMEVsOUVZanJFeWpFZnJaV3JacnhtYyIsImd0eSI6ImNsaWVudC1jcmVkZW50aWFscyJ9.aYbirF4SQPnwSRyfYC6PSrf1ke-395k26F3OjPqvz8Pd531Y30xLzybCot3V0Obt-BpA5YK8-XkIkBi2vFWTCmiz9bu8P1DYRM94HuYBwx8IqNX3feZJ9pW52SIv_UdknDz8CjzwlFBiFLv6m1OUqDavG-87D6nQv41GSajGGlN1sWAFkg26T-aAKF7L9JFMYRSEl6DbbEXyueeK7lCvU88hHbbDbKpcF_fLkDPau31E4G_WwUL_JpKacoNmtMaQvvcgTNi1C_E7s1vY6Rmz18A0EcdoCyIB4lHQIDvjbybn39Az9oJiW0KX6KCIWWCYL0Tbz74iFpdhWXAQyceI3A",
    "expires_in": 86400,
    "token_type": "Bearer"
}
```

### Requesting credentials

The URL to GET credentials from is

`https://app.supplypike.com/api/credentials/:id`