Skip to main content
Version: Next

Interface: WaspAuthConfig

Configuration of Wasp's own auth: which methods are enabled, plus everything that only makes sense when Wasp itself runs the signup and login flows.

Extends

  • AuthHooks

Fields

methods

methods: Required<Pick<LocalAuthMethods, "usernameAndPassword">> & Partial<Record<"email", never>> & Omit<LocalAuthMethods, keyof LocalAuthMethods> & ExternalAuthMethods & object | never | Required<Pick<LocalAuthMethods, "usernameAndPassword">> & Partial<Record<"email", never>> & Omit<LocalAuthMethods, keyof LocalAuthMethods> & ExternalAuthMethods & object | Required<Pick<LocalAuthMethods, "usernameAndPassword">> & Partial<Record<"email", never>> & Omit<LocalAuthMethods, keyof LocalAuthMethods> & ExternalAuthMethods & object | Required<Pick<LocalAuthMethods, "usernameAndPassword">> & Partial<Record<"email", never>> & Omit<LocalAuthMethods, keyof LocalAuthMethods> & ExternalAuthMethods & object | Required<Pick<LocalAuthMethods, "usernameAndPassword">> & Partial<Record<"email", never>> & Omit<LocalAuthMethods, keyof LocalAuthMethods> & ExternalAuthMethods & object | Required<Pick<LocalAuthMethods, "usernameAndPassword">> & Partial<Record<"email", never>> & Omit<LocalAuthMethods, keyof LocalAuthMethods> & ExternalAuthMethods & object | Required<Pick<LocalAuthMethods, "usernameAndPassword">> & Partial<Record<"email", never>> & Omit<LocalAuthMethods, keyof LocalAuthMethods> & ExternalAuthMethods & object | never | Required<Pick<LocalAuthMethods, "email">> & Partial<Record<"usernameAndPassword", never>> & Omit<LocalAuthMethods, keyof LocalAuthMethods> & ExternalAuthMethods & object | Required<Pick<LocalAuthMethods, "email">> & Partial<Record<"usernameAndPassword", never>> & Omit<LocalAuthMethods, keyof LocalAuthMethods> & ExternalAuthMethods & object | Required<Pick<LocalAuthMethods, "email">> & Partial<Record<"usernameAndPassword", never>> & Omit<LocalAuthMethods, keyof LocalAuthMethods> & ExternalAuthMethods & object | Required<Pick<LocalAuthMethods, "email">> & Partial<Record<"usernameAndPassword", never>> & Omit<LocalAuthMethods, keyof LocalAuthMethods> & ExternalAuthMethods & object | Required<Pick<LocalAuthMethods, "email">> & Partial<Record<"usernameAndPassword", never>> & Omit<LocalAuthMethods, keyof LocalAuthMethods> & ExternalAuthMethods & object | Required<Pick<LocalAuthMethods, "email">> & Partial<Record<"usernameAndPassword", never>> & Omit<LocalAuthMethods, keyof LocalAuthMethods> & ExternalAuthMethods & object | Required<Pick<LocalAuthMethods, "email">> & Partial<Record<"usernameAndPassword", never>> & Omit<LocalAuthMethods, keyof LocalAuthMethods> & ExternalAuthMethods & object | never | never | Partial<Record<keyof LocalAuthMethods, never>> & Omit<LocalAuthMethods, keyof LocalAuthMethods> & ExternalAuthMethods & object | Partial<Record<keyof LocalAuthMethods, never>> & Omit<LocalAuthMethods, keyof LocalAuthMethods> & ExternalAuthMethods & object | Partial<Record<keyof LocalAuthMethods, never>> & Omit<LocalAuthMethods, keyof LocalAuthMethods> & ExternalAuthMethods & object | Partial<Record<keyof LocalAuthMethods, never>> & Omit<LocalAuthMethods, keyof LocalAuthMethods> & ExternalAuthMethods & object | Partial<Record<keyof LocalAuthMethods, never>> & Omit<LocalAuthMethods, keyof LocalAuthMethods> & ExternalAuthMethods & object | Partial<Record<keyof LocalAuthMethods, never>> & Omit<LocalAuthMethods, keyof LocalAuthMethods> & ExternalAuthMethods & object

Enabled authentication methods. At least one method must be enabled -- with none, nobody could ever sign in, which is better expressed by choosing an external provider or dropping auth altogether.


onAfterEmailVerified?

optional onAfterEmailVerified?: Reference<AnyFunction>

Called once, after the user verifies their email. Receives email and user.

Inherited from

AuthHooks.onAfterEmailVerified


onAuthSucceededRedirectTo?

optional onAuthSucceededRedirectTo?: string

Route that Wasp redirects users to after a successful login or signup.

Only takes effect when using Wasp's built-in Auth UI.

See Auth UI.

Default

"/"

Hooks

onAfterLogin?

optional onAfterLogin?: Reference<AnyFunction>

Called after a successful login. Receives providerId, user, and, for social auth, oauth fields including tokens and the unique OAuth request ID.

Inherited from

AuthHooks.onAfterLogin


onAfterSignup?

optional onAfterSignup?: Reference<AnyFunction>

Called after the user is created. Receives providerId, the created user, and, for social auth, oauth fields including tokens and the unique OAuth request ID.

Inherited from

AuthHooks.onAfterSignup


onBeforeLogin?

optional onBeforeLogin?: Reference<AnyFunction>

Called before the user is logged in. Receives providerId and user. Throw from this hook to reject a login based on custom criteria.

Inherited from

AuthHooks.onBeforeLogin


onBeforeOAuthRedirect?

optional onBeforeOAuthRedirect?: Reference<AnyFunction>

Called before redirecting the user to the OAuth provider. Receives the generated url and oauth.uniqueRequestId. Return { url } to override the redirect URL.

Inherited from

AuthHooks.onBeforeOAuthRedirect


onBeforeSignup?

optional onBeforeSignup?: Reference<AnyFunction>

Called before the user is created. Receives providerId plus the common hook input. Throw from this hook to reject a signup based on custom criteria.

Inherited from

AuthHooks.onBeforeSignup