fullauth / DOCS / Providers / credentials
GitHub

DOCUMENTATION / PROVIDERS

Credentials provider

CredentialsProvider passes submitted fields to an application-provided signIn function. It does not ship a user store, password hashing, registration flow, or email/password policy.

Configure credentials verification

This route example is intentionally partial: verifyUser is your application function. Implement it using your own user store and password-hash verification; return a user object for an accepted login or null for a rejected one.

app/api/auth/[...fullauth]/route.ts

import type { AuthOptions } from '@fullauth/core';
import { CredentialsProvider } from '@fullauth/core/providers';
import { NextHandler } from '@fullauth/next';
import { verifyUser } from '@/lib/verify-user'; // App-defined, not a FullAuth export

export const authOptions: AuthOptions = {
  secret: process.env.FULLAUTH_SECRET!,
  providers: [
    CredentialsProvider({
      credentials: {
        email: { type: 'text' },
        password: { type: 'password' },
      },
      async signIn(credentials) {
        return verifyUser(credentials);
      },
    }),
  ],
};

const handler = NextHandler(authOptions);
export { handler as GET, handler as POST };

Configure distinct credential flows

Provider IDs are used by the client’s signIn call. Keep each ID unique and implement each verifier in your application.

Provider entries in authOptions

import { CredentialsProvider } from '@fullauth/core/providers';
import { verifyMember, verifyAdmin } from '@/lib/verify-user'; // App-defined

const providers = [
  CredentialsProvider({
    id: 'member',
    credentials: {
      email: { type: 'text' },
      password: { type: 'password' },
    },
    signIn: verifyMember, // App-defined verifier
  }),
  CredentialsProvider({
    id: 'admin',
    credentials: {
      email: { type: 'text' },
      password: { type: 'password' },
    },
    signIn: verifyAdmin, // App-defined verifier
  }),
];

For the built-in Google OAuth module, see the Google provider guide. No built-in GitHub, Facebook, Apple, or Microsoft provider is included in the current source.