#Firebase email/password login,

2 messages · Page 1 of 1 (latest)

minor lintel
#

Cannot find any examples of implementing this logic properly in NextAuth.

  providers: [
    GoogleProvider({
      clientId: config.google.clientId,
      clientSecret: config.google.clientSecret,
    }),
    CredentialsProvider({
      name: "Credentials",
      credentials: {
        email: {
          label: "Email",
          type: "text",
          placeholder: "[email protected]",
        },
        password: { label: "Password", type: "password" },
      },
      async authorize(credentials) {
        if (!credentials) return null;

        // sanitize credentials
        credentials.email = credentials.email.trim().toLowerCase();
        credentials.password = credentials.password.trim();

        const userCredential = await signInWithEmailAndPassword(
          auth,
          credentials.email,
          credentials.password
        );
        
        const user = userCredential.user;

        if (!user) return null;

        return {
          id: user.uid,
          email: user.email,
        };
      },
    }),
    // ...add more providers here
  ],

these are my providers, the google provider works perfectly, however I am having trouble setting up the email/password firebase method. Any ideas on what could be wrong here?

slate hatchBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

      🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in <id:customize>

      ✅ You can mark a message as the answer for your post with `Right click -> Apps -> Mark Solution`
      (if you don't see the option, try refreshing Discord with Ctrl + R)