# IdentityModel

**Kind:** Service

**Source:** `Pams/API/Pams.API/Pams.API.csproj` (line 1)

**Part of:** [Pams](subsystem-pams)

NuGet package dependency

IdentityModel is a NuGet package dependency declared by `Pams.API`. The API references it for identity and token-related .NET integration, while browser clients interact with the API through its authentication boundary.

## Diagram

```mermaid
sequenceDiagram
    participant Client
    participant Auth as Identity Provider
    participant API as Pams.API
    participant IM as IdentityModel

    Client->>Auth: Request access token
    Auth-->>Client: Return access token
    Client->>API: Send request with Bearer token
    API->>IM: Process identity and token data
    IM-->>API: Return identity result
    API-->>Client: Return API response
```

## Usage

```ts
const accessToken = process.env.PAMS_ACCESS_TOKEN;

const response = await fetch("https://pams.example/api/resources", {
  headers: {
    Authorization: `Bearer ${accessToken}`,
    Accept: "application/json",
  },
});

if (!response.ok) {
  throw new Error(`Pams.API request failed: ${response.statusText}`);
}

const data = await response.json();
console.log(data);
```

## AI Coding Instructions

- Keep IdentityModel references inside the `Pams.API` .NET project and its authentication-related code paths.
- Check the package API and target framework compatibility before changing the dependency version.
- Do not expose token parsing, validation details, or identity-provider settings to browser clients.
- Keep API authentication behavior aligned with the identity provider configuration and request middleware.

## Used by

1 reference from 1 file. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

### Injected or called by (1)

- `Pams.API` — `Pams/API/Pams.API/Pams.API.csproj`:1
