# Microsoft.AspNet.Identity.Core

**Kind:** Service

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

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

NuGet package dependency

`Microsoft.AspNet.Identity.Core` is a NuGet dependency referenced by the legacy-format `Pams.Core` project. It supplies the ASP.NET Identity contracts and types used by the server-side authentication and user-management code.

## Diagram

```mermaid
sequenceDiagram
    participant Client
    participant Api as PAMS API
    participant Identity as Microsoft.AspNet.Identity.Core
    participant Store as User Store

    Client->>Api: Send sign-in request
    Api->>Identity: Validate user credentials
    Identity->>Store: Load user and credential data
    Store-->>Identity: Return user data
    Identity-->>Api: Return authentication result
    Api-->>Client: Return authenticated response
```

## Usage

```ts
async function signIn(userName: string, password: string) {
  const response = await fetch("/api/account/login", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    body: JSON.stringify({ userName, password }),
  });

  if (!response.ok) {
    throw new Error("Sign-in failed");
  }

  return response.json();
}

signIn("user@example.com", "password")
  .then((session) => console.log(session))
  .catch((error) => console.error(error));
```

## AI Coding Instructions

- Keep `Microsoft.AspNet.Identity.Core` usage inside server-side authentication and user-management paths.
- Preserve compatibility with the legacy project format when changing package references.
- Use Identity interfaces and types instead of duplicating password validation or user-store logic.
- Confirm API login endpoints map authentication failures to safe client responses without exposing credential details.
