remix-auth - v4.2.0
    Preparing search index...

    Class Authenticator<User>

    Create a new instance of the Authenticator.

    It receives a instance of a Cookie created using Remix's createCookie.

    It optionally receives an object with extra options. The supported options are:

    let auth = new Authenticator();
    

    Type Parameters

    • User = unknown
    Index

    Constructors

    Methods

    Constructors

    Methods

    • Call this to authenticate a request using some strategy. You pass the name of the strategy you want to use and the request to authenticate.

      Parameters

      Returns Promise<User>

      async function action({ request }: ActionFunctionArgs) {
      let user = await auth.authenticate("strategy-name", request);
      };
    • Call this method with the name of a strategy you want to get. It returns the Strategy instance or null if the strategy is not found.

      Type Parameters

      Parameters

      • name: string

      Returns null | S

    • Call this method with the name of the strategy you want to remove. It returns the Authenticator instance for concatenation.

      Parameters

      • name: string

      Returns Authenticator

      auth.unuse("another").unuse("some");
      
    • Call this method with the Strategy, the optional name allows you to setup the same strategy multiple times with different names. It returns the Authenticator instance for concatenation.

      Parameters

      Returns Authenticator<User>

      auth.use(new SomeStrategy((user) => Promise.resolve(user)));
      auth.use(new SomeStrategy((user) => Promise.resolve(user)), "another");