Skip to content

Microsoft.Owin.Security.Cookies

reference
1 min readUpdated

Kind: Service

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

Part of: Pams

NuGet package dependency

Microsoft.Owin.Security.Cookies is a NuGet dependency that provides cookie-based authentication middleware for the Pams API. It reads authentication cookies on incoming requests and writes or removes cookies during sign-in and sign-out flows.

Diagram

mermaid
sequenceDiagram
    participant Client
    participant API as Pams API
    participant Cookies as OWIN Cookie Middleware

    Client->>API: Request with authentication cookie
    API->>Cookies: Process request authentication
    Cookies-->>API: Authenticated user identity or anonymous request
    API-->>Client: Protected response or authentication challenge

Usage

ts
const response = await fetch("/api/pams/records", {
  method: "GET",
  credentials: "include",
  headers: {
    Accept: "application/json",
  },
});

if (!response.ok) {
  throw new Error("Request was not authenticated");
}

const records = await response.json();
console.log(records);

AI Coding Instructions

  • Treat this package as server-side OWIN middleware configured by the Pams API project.
  • Send browser API requests with credentials: "include" when authentication depends on cookies.
  • Do not place authentication cookies in JavaScript-managed storage or manually add them to request headers.
  • Check cookie middleware configuration when protected API endpoints return authentication challenges.
  • Keep cookie authentication settings aligned with the API's authorization rules and sign-in flow.

Was this page helpful?

Download as PDF