sergiodxa / remix-auth

Simple Authentication for Remix

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LocalStrategy not found

hgeldenhuys opened this issue · comments

Describe the bug

Following the example code for Local Strategy, the import for LocalStrategy is missing or not found using
import { Authenticator, LocalStrategy } from "remix-auth";

import { Authenticator, LocalStrategy } from "remix-auth";

Your Example Website or App

examples/local

Steps to Reproduce the Bug or Issue

Install npm packages and try to run the app

Expected behavior

Compiler should not complain about missing import

Screenshots or Videos

Screen Shot 2022-01-22 at 3 18 55 PM

Platform

  • OS: macOS
  • Browser: Chrome, Brave (but N/A)
  • Version: N/A

Additional context

No response

LocalStrategy change to FormStrategy with 'remix-auth-form'

import { FormStrategy } from "remix-auth-form";

// Tell the Authenticator to use the form strategy
authenticator.use(
  new FormStrategy(async ({ form }) => {
    let email = form.get("email");
    let password = form.get("password");
    let user = await login(email, password);
    // the type of this user must match the type you pass to the Authenticator
    // the strategy will automatically inherit the type if you instantiate
    // directly inside the `use` method
    return user;
  }),
  // each strategy has a name and can be changed to use another one
  // same strategy multiple times, especially useful for the OAuth2 strategy.
  "user-pass"
);

Strategies are not exported from the remix-auth package but from individual packages, the LocalStrategy was also replaced by the FormStrategy.

I just removed docs and examples from the repo, you can see examples in the Remix repo.