Emailpass Auth Module Provider
In this guide, you’ll learn about the Emailpass Auth Module Provider and how to configure it.
By using the Emailpass Auth Module Provider, you allow users to register and log in with an email and password.
Register the Emailpass Auth Module Provider#
The Emailpass Auth Module Provider is registered by default with the Auth Module, both on Cloud and locally. You don't need to configure it or set any environment variables.
If you want to pass options to the provider, add the provider to the providers option of the Auth Module in your medusa-config.ts:
import { Modules, ContainerRegistrationKeys } from "@medusajs/framework/utils"
// ...
module.exports = defineConfig({
// ...
modules: [
{
resolve: "@medusajs/medusa/auth",
dependencies: [Modules.CACHE, ContainerRegistrationKeys.LOGGER],
options: {
mfa: {
encryption_key: process.env.AUTH_MFA_ENCRYPTION_KEY,
},
providers: [
// other providers...
{
resolve: "@medusajs/medusa/auth-emailpass",
id: "emailpass",
options: {
// options...
},
},
],
},
},
],
})
Deploy to Cloud#
If you change the provider's options, commit the changes to medusa-config.ts and push them to the branch that your Cloud environment tracks. Cloud then creates a deployment that uses the new options.
Module Options#
require_verification option was removed since Medusa v2.16.0. Use the authVerificationsPerActor configuration instead.Configuration | Description | Required | Default |
|---|---|---|---|
| An object of configurations for hashing the user's password. Refer to scrypt-kdf's documentation for accepted options. | No | |
Password Updates and Existing Tokens#
When a user's password is updated, for example, after they reset their password, the Emailpass provider stores the date of the update in the provider identity's provider_metadata.password_updated_at property.
Medusa then refuses to refresh any token issued before that date, or to use it to verify an MFA challenge. So, the user must log in again with their new password.