TutorialsUser authentification

ShipFast uses NextAuth to authenticate users. You can configure it in the /pages/api/auth/[...nextauth].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

1import { signIn } from "next-auth/react";
2import config from "@/config";
3                
4const SigninButton = () => {
5  return (
6    <button
7      className="btn btn-primary"
8      onClick={() => signIn(undefined, { callbackUrl: config.callbackUrl })}
9    >
10      Login
11    </button>
12  );
13};
14                
15export 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