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:

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#

Note: The require_verification option was removed since Medusa v2.16.0. Use the authVerificationsPerActor configuration instead.

Configuration

Description

Required

Default

hashConfig

An object of configurations for hashing the user's password. Refer to scrypt-kdf's documentation for accepted options.

No

const hashConfig = {
  logN: 15,
  r: 8,
  p: 1
}

Password Updates and Existing Tokens#

Note: This behavior is available since Medusa v2.23.1.

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.


Was this page helpful?
Docs Assistant
For assistance in your development, use Claude Code Plugins or Docs MCP server in Cursor, VSCode, etc...FAQ
What is Medusa?
How can I create a module?
How can I create a data model?
How do I create a workflow?
How can I extend a data model in the Product Module?
Recipes
How do I build a marketplace with Medusa?
How do I build digital products with Medusa?
How do I build subscription-based purchases with Medusa?
What other recipes are available in the Medusa documentation?
Chat is cleared on refresh
Line break
⇧↵