• Version 0.2.38
  • Published
  • 5.54 kB
  • 2 dependencies
  • MIT license


npm i @types/passport-strategy
yarn add @types/passport-strategy
pnpm add @types/passport-strategy


TypeScript definitions for passport-strategy



class Strategy

class Strategy implements passport.Strategy {}

    method authenticate

    authenticate: (req: express.Request, options?: any) => void;
    • Performs authentication for the request. Note: Virtual function - re-implement in the strategy.

      Parameter req

      The request to authenticate.

      Parameter options

      Options passed to the strategy.

    method error

    error: (err: Error) => void;
    • Internal error while performing authentication.

      Strategies should call this function when an internal error occurs during the process of performing authentication; for example, if the user directory is not available.

      Parameter err


    method fail

    fail: { (challenge: any, status: number): void; (status: number): void };
    • Fail authentication, with optional challenge and status, defaulting to 401.

      Strategies should call this function to fail an authentication attempt.

      Parameter challenge

      (Can also be an object with 'message' and 'type' fields).

      Parameter status


    method pass

    pass: () => void;
    • Pass without making a success or fail decision.

      Under most circumstances, Strategies should not need to call this function. It exists primarily to allow previous authentication state to be restored, for example from an HTTP session.


    method redirect

    redirect: (url: string, status?: number) => void;
    • Redirect to url with optional status, defaulting to 302.

      Strategies should call this function to redirect the user (via their user agent) to a third-party website for authentication.

      Parameter url

      Parameter status


    method success

    success: (user: any, info?: any) => void;
    • Authenticate user, with optional info.

      Strategies should call this function to successfully authenticate a user. user should be an object supplied by the application after it has been given an opportunity to verify credentials. info is an optional argument containing additional user information. This is useful for third-party authentication strategies to pass profile details.

      Parameter user

      Parameter info


    Package Files (1)

    Dependencies (2)

    Dev Dependencies (0)

    No dev dependencies.

    Peer Dependencies (0)

    No peer dependencies.


    To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

    You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/passport-strategy.

    • Markdown
    • HTML
      <a href="https://www.jsdocs.io/package/@types/passport-strategy"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>