Back to Medusa

{metadata.title}

www/apps/resources/app/commerce-modules/auth/auth-providers/emailpass/page.mdx

2.14.22.2 KB
Original Source

import { Table } from "docs-ui"

export const metadata = { title: Emailpass Auth Module Provider, }

{metadata.title}

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.

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:

ts
import { Modules, ContainerRegistrationKeys } from "@medusajs/framework/utils"

// ...

module.exports = defineConfig({
  // ...
  modules: [
    {
      resolve: "@medusajs/medusa/auth",
      dependencies: [Modules.CACHE, ContainerRegistrationKeys.LOGGER],
      options: {
        providers: [
          // other providers...
          {
            resolve: "@medusajs/medusa/auth-emailpass",
            id: "emailpass",
            options: {
              // options...
            },
          },
        ],
      },
    },
  ],
})

Module Options

<Table> <Table.Header> <Table.Row> <Table.HeaderCell>Configuration</Table.HeaderCell> <Table.HeaderCell>Description</Table.HeaderCell> <Table.HeaderCell>Required</Table.HeaderCell> <Table.HeaderCell>Default</Table.HeaderCell> </Table.Row> </Table.Header> <Table.Body> <Table.Row> <Table.Cell>
  `hashConfig`
  
  </Table.Cell>
  <Table.Cell>
  
  An object of configurations for hashing the user's 
  password. Refer to [scrypt-kdf](https://www.npmjs.com/package/scrypt-kdf#-hash)'s
  documentation for accepted options. 
  
  </Table.Cell>
  <Table.Cell>
  
  No
  
  </Table.Cell>
  <Table.Cell>
  
  ```ts blockStyle="inline"
  const hashConfig = {
    logN: 15,
    r: 8,
    p: 1
  }
  ```
  
  </Table.Cell>
</Table.Row>

</Table.Body>

</Table>