← @mortar-kit/auth

createAuthfunction

import { createAuth } from '@mortar-kit/auth'

function createAuth<User>(options: AuthOptions<User>): Auth<User>

Sign-in for the admin. Put handle first in the app's middleware and require first in each server function that writes.

Parameters

options: AuthOptions<User>

Returns

Auth<User>

Example

const auth = createAuth({
  methods: [google({ clientId, clientSecret }), email({ mailer, store })],
  authorize: allowEmails(['[email protected]', '*@example.com']),
  secret: process.env.MORTAR_AUTH_SECRET!,
});