Retrieves a readonly record of all registered strategies. Useful if the strategy exposes additional methods.
The public type omits authenticate so callers go through
Authenticator.authenticate. Runtime instances still expose the method
on the strategy prototype.
Authenticates a request using the specified strategy.
This method delegates the authentication process to the named strategy and returns the authenticated user data if successful.
Promise resolving to the session data
async function action({ request }: ActionFunctionArgs) {
try {
const sessionData = await auth.authenticate("login", request);
// User is authenticated, do something with the session data
return redirect("/dashboard");
} catch (error) {
// Handle authentication error
return json({ error: error.message });
}
}
The Authenticator class is the main entry point for Remix Auth.
It manages authentication strategies and provides methods to authenticate requests. Each strategy is registered with a name, which is used to identify it during the authentication process.
Example