UNPKG

@happykit/auth-email

Version:

- A `useAuth` hook which returns the current user - An optional `getServerSideAuth` for server-side rendering - HappyAuth is tiny - it adds only 4.6 kB to the first load JS - it adds less than 0.04 kB if you're transitioning from another page - Extremely

23 lines (20 loc) 701 B
import { createGetServerSideAuth, sendConfirmAccountMailToConsole, sendForgotPasswordMailToConsole, createFaunaEmailDriver, } from "@happykit/auth-email/api" import { faunaClient } from "fauna-client" export const serverConfig = { tokenSecret: process.env.HAPPYAUTH_TOKEN_SECRET, cookieName: "happyauth", secure: process.env.NODE_ENV === "production", identityProviders: {}, triggers: { sendConfirmAccountMail: sendConfirmAccountMailToConsole, sendForgotPasswordMail: sendForgotPasswordMailToConsole, }, driver: createFaunaEmailDriver(faunaClient), } /* you can probably leave these as they are */ export const getServerSideAuth = createGetServerSideAuth(serverConfig)