npm.io
2.22.7 • Published 4d ago

@medusajs/auth-emailpass

Licence
MIT
Version
2.22.7
Deps
1
Size
23 kB
Vulns
0
Weekly
0
Stars
36.6K

Medusa logo

@medusajs/auth-emailpass

Documentation | Website

Building blocks for digital commerce

Medusa is released under the MIT license. PRs welcome! Discord Chat Follow @medusajs

Email/Password Auth Module Provider for Medusa: authenticates users and customers with an email (or other identifier) and a password hashed with scrypt. It's the default auth provider of the Auth Module, so admin users and customers can log in with email and password out of the box. It ships with @medusajs/medusa and is registered through the @medusajs/medusa/auth-emailpass path.

At a glance

Package @medusajs/auth-emailpass
Type Module Provider (Auth Module)
Provider ID emailpass
Registered by default Yes, with id: "emailpass"
Import from @medusajs/medusa/auth-emailpass

Installation

No installation needed. The provider is a dependency of @medusajs/medusa and is registered by default.

Usage

You only need to register the provider yourself to pass options, or when you override the Auth Module's providers array (for example, to add another provider). Keep emailpass in the list in that case:

import { defineConfig } from "@medusajs/framework/utils"

module.exports = defineConfig({
  // ...
  modules: [
    {
      resolve: "@medusajs/medusa/auth",
      options: {
        providers: [
          {
            resolve: "@medusajs/medusa/auth-emailpass",
            id: "emailpass",
            options: {
              // optional
            },
          },
        ],
      },
    },
  ],
})

Configuration

Option Type Description Default
hashConfig { logN: number, r: number, p: number } The scrypt parameters used to hash passwords. { logN: 15, r: 8, p: 1 }

Resources

Keywords