npm.io
0.3.1 • Published 1 month ago

@passport-next/passport-types

Licence
MIT
Version
0.3.1
Deps
0
Size
2 kB
Vulns
0
Weekly
0

@passport-next/passport-types

Dependency-light, augmentable contracts shared by Passport Next, applications, and authentication strategies.

Install

pnpm i @passport-next/passport-types @passport-next/http-types

Usage

import type {
  AuthInfo,
  Request,
  User,
} from '@passport-next/passport-types';

Applications describe their own authentication values with module augmentation:

import '@passport-next/passport-types';

declare module '@passport-next/passport-types' {
  interface User {
    id: string;
    username: string;
  }

  interface AuthInfo {
    scope?: string[];
  }

  interface Request {
    tenantId?: string;
  }
}

The base Request extends the framework-neutral request from @passport-next/http-types, so augmentations to that package are also visible to Passport consumers.

Keywords