Skip to content

User Authentication

Fresh

Source: shipfa.st/docs/tutorials/user-auth

ShipFast uses NextAuth for authentication, configured in /app/api/auth/[...nextauth]/route.js.

Authentication Methods

MethodSetup Guide
Magic LinksMagic Links Feature
Google OAuthGoogle OAuth Feature

Login Button Example

After setting up at least one auth method:

javascript
"use client"

import { signIn } from "next-auth/react";
import config from "@/config";

const SigninButton = () => {
  return (
    <button
      className="btn btn-primary"
      onClick={() => signIn(undefined, { callbackUrl: config.auth.callbackUrl })}
    >
      Login
    </button>
  );
};

export default SigninButton;

INFO

The callbackUrl in config.js redirects users after successful login. Usually set to a private page like /dashboard.

See Also