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",
},
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