# Microsoft.AspNet.Identity.Owin

**Kind:** Service

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

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

NuGet package dependency

`Microsoft.AspNet.Identity.Owin` is a NuGet package dependency declared by the `Pams.API` project. It connects ASP.NET Identity with the OWIN request pipeline so the API can handle identity-related middleware, authentication context, and user-manager access.

## Diagram

```mermaid
flowchart LR
    Client[Client Application] --> Api[Pams.API]
    Api --> Owin[OWIN Pipeline]
    Owin --> Identity[ASP.NET Identity]
    Identity --> Store[User Store]
```

## Usage

```ts
// This package runs on the ASP.NET server.
// A client sends authenticated requests to the API endpoint protected by OWIN Identity.

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

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

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

## AI Coding Instructions

- Keep `Microsoft.AspNet.Identity.Owin` aligned with the ASP.NET Identity and OWIN package versions referenced by `Pams.API`.
- Configure authentication middleware before API routes that require authenticated users.
- Access identity managers from the OWIN context rather than creating managers directly in request handlers.
- Treat this as a server-side dependency; browser code should call protected API endpoints with the required authentication token.
