> ## Documentation Index
> Fetch the complete documentation index at: https://docs.medera.info/llms.txt
> Use this file to discover all available pages before exploring further.

# JavaScript SDK — Authentication

> All authentication methods for the Medera JavaScript SDK

## Client credentials (server-side)

```typescript theme={"system"}
const auth = new MederaAuth({ clientId: process.env.MEDERA_CLIENT_ID!, clientSecret: process.env.MEDERA_CLIENT_SECRET!, audience: 'api.medera.info',
});

```

## Bearer token (already obtained)

```typescript theme={"system"}
const client = new MederaClient({ accessToken: 'eyJhbGciOi...',
});

```

## End-user JWT (acting on behalf of a clinician)

```typescript theme={"system"}
const client = new MederaClient({ accessToken: userSessionJwt,
});

```
