# Microsoft.IdentityModel.Logging

**Kind:** Service

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

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

NuGet package dependency

`Microsoft.IdentityModel.Logging` is a NuGet package dependency declared in `Pams.API.csproj`. It supports identity-related logging within the Pams API authentication path. JavaScript clients do not import this .NET package directly; they call API endpoints that may record identity diagnostics.

## Diagram

```mermaid
sequenceDiagram
    participant Client as JavaScript Client
    participant Api as Pams API
    participant Identity as Identity Pipeline
    participant Logging as Microsoft.IdentityModel.Logging

    Client->>Api: Send authenticated request
    Api->>Identity: Validate token
    Identity->>Logging: Record identity diagnostic
    Identity-->>Api: Return validation result
    Api-->>Client: Return API response
```

## Usage

```ts
async function getCurrentUser(accessToken: string) {
  const response = await fetch("/api/users/me", {
    headers: {
      Authorization: `Bearer ${accessToken}`,
    },
  });

  if (!response.ok) {
    throw new Error(`Request failed: ${response.status}`);
  }

  return response.json();
}

// Identity-related failures are handled by Pams API.
// Microsoft.IdentityModel.Logging records diagnostics on the .NET server.
getCurrentUser("access-token")
  .then((user) => console.log(user))
  .catch((error) => console.error(error));
```

## AI Coding Instructions

- Keep `Microsoft.IdentityModel.Logging` referenced through the Pams API project file; do not add it to JavaScript client projects.
- Treat identity logging as server-side behavior and avoid returning token or authentication diagnostic details to clients.
- Check the Pams API authentication configuration before changing package versions or identity logging behavior.
- Keep client code focused on authenticated API requests and normal HTTP error handling.
