Skip to main content
API Reference / modelence / server / AuthConfig
AuthConfig = object
Defined in: src/app/authConfig.ts:42 Authentication configuration for the application

Example

import { startApp } from 'modelence/server';

startApp({
  auth: {
    onAfterLogin: ({ user }) => {
      console.log('User logged in:', user.name);
      // Redirect to dashboard
    },
    onLoginError: ({ error }) => {
      console.error('Login failed:', error.message);
      // Show error toast
    },
    onAfterSignup: ({ user }) => {
      console.log('User signed up:', user.email);
      // Send welcome email
    },
    onSignupError: ({ error }) => {
      console.error('Signup failed:', error.message);
    }
  }
});

Properties

PropertyTypeDescriptionDefined in
login?AuthOptiondeprecated: use onAfterLogin and onLoginErrorsrc/app/authConfig.ts:65
onAfterLogin?(props) => void-src/app/authConfig.ts:43
onAfterSignup?(props) => void-src/app/authConfig.ts:53
onLoginError?(props) => void-src/app/authConfig.ts:48
onSignupError?(props) => void-src/app/authConfig.ts:58
signup?AuthOptiondeprecated: user onAfterSignup and onSignupErrorsrc/app/authConfig.ts:67
I