Skip to main content
Version: 0.24

Interface: EmailAuthConfig

Email auth configuration.

See the Email auth docs for the full signup, verification, and password reset flows.

Exampleโ€‹

import { app } from "@wasp.sh/spec"
import { userSignupFields } from "./src/auth" with { type: "ref" }
import {
getVerificationEmailContent,
getPasswordResetEmailContent,
} from "./src/auth/email" with { type: "ref" }

export default app({
// ...
auth: {
userEntity: "User",
methods: {
email: {
userSignupFields,
fromField: {
name: "My App",
email: "hello@itsme.com",
},
emailVerification: {
clientRoute: "EmailVerificationRoute",
getEmailContentFn: getVerificationEmailContent,
},
passwordReset: {
clientRoute: "PasswordResetRoute",
getEmailContentFn: getPasswordResetEmailContent,
},
},
},
onAuthFailedRedirectTo: "/login",
},
})

Extendsโ€‹

  • BaseAuthMethodConfig

Propertiesโ€‹

emailVerificationโ€‹

emailVerification: EmailFlowConfig

An object that specifies the details of the e-mail verification process.


fromFieldโ€‹

fromField: EmailFromField

Sender identity used for verification and password reset emails.


passwordResetโ€‹

passwordReset: EmailFlowConfig

An object that specifies the password reset process.


userSignupFields?โ€‹

optional userSignupFields?: Reference<AnyObject>

Object that defines extra fields to save on the user during signup (e.g. firstName, address). Each field name must exist on the configured Auth.userEntity.

Each field function receives the data sent from the client and returns the value Wasp saves to the database. For social auth, this data includes provider-specific profile information. If the value is invalid, throw an error. The password field is excluded from this object and handled by Wasp's auth backend.

See Signup Fields Customization.

Exampleโ€‹

import { defineUserSignupFields } from 'wasp/server/auth'

export const userSignupFields = defineUserSignupFields({
address: (data) => {
if (!data.address) {
throw new Error('Address is required')
}
return data.address
},
phone: (data) => data.phone,
})

Inherited fromโ€‹

BaseAuthMethodConfig.userSignupFields