# Microsoft.Owin.Security.Google

**Kind:** Service

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

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

NuGet package dependency

`Microsoft.Owin.Security.Google` is a NuGet package dependency in `Pams.API` that provides Google authentication middleware for the OWIN pipeline. It redirects users to Google for sign-in, receives the authentication callback, and creates an authenticated identity for the API.

## Diagram

```mermaid
sequenceDiagram
    participant Client
    participant PamsAPI as Pams.API
    participant Google

    Client->>PamsAPI: Request Google sign-in endpoint
    PamsAPI->>Google: Redirect to Google authorization page
    Google->>Client: Display sign-in and consent page
    Client->>Google: Complete authentication
    Google->>PamsAPI: Send authorization callback
    PamsAPI->>Client: Create authenticated session or return token
```

## Usage

```ts
function signInWithGoogle(): void {
  window.location.assign("/auth/google");
}

document
  .querySelector<HTMLButtonElement>("#google-sign-in")
  ?.addEventListener("click", signInWithGoogle);
```

## AI Coding Instructions

- Keep Google authentication configuration in the OWIN startup pipeline for `Pams.API`.
- Store the Google client ID and client secret outside source control, such as application configuration or environment settings.
- Match the Google callback URL with the callback path configured by the OWIN Google authentication middleware.
- Route client sign-in actions through the API endpoint that starts the Google authentication challenge.
- Check that the authenticated identity is compatible with the API authorization and session handling code.

## 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
