TutorialsUser authentication

ShipFast uses NextAuth to authenticate users. You can configure it in the /app/api/auth/[...nextauth]/route.js file.

There are 2 built-in ways to authenticate users with ShipFast: Magic Links & Google Oauth.

Once you've completed at least one of the tutorials above, you can login users like this:

ButtonSignin.js

1"use client"
2
3import { signIn } from "next-auth/react";
4import config from "@/config";
5                
6const SigninButton = () => {
7  return (
8    <button
9      className="btn btn-primary"
10      onClick={() => signIn(undefined, { callbackUrl: config.auth.callbackUrl })}
11    >
12      Login
13    </button>
14  );
15};
16                
17export default SigninButton;
The callbackUrl variable in the config.js file is used accross the app to redirect the user at the right place after a successfull sign-up/login. It's usually a private page like /dashboard