|
1
|
import { Table } from "docs-ui" |
|
2
|
|
|
3
|
export const metadata = { |
|
4
|
title: `Emailpass Auth Module Provider`, |
|
5
|
} |
|
6
|
|
|
7
|
# {metadata.title} |
|
8
|
|
|
9
|
In this guide, you’ll learn about the Emailpass Auth Module Provider and how to configure it. |
|
10
|
|
|
11
|
By using the Emailpass Auth Module Provider, you allow users to register and log in with an email and password. |
|
12
|
|
|
13
|
## Register the Emailpass Auth Module Provider |
|
14
|
|
|
15
|
The Emailpass Auth Module Provider is registered by default with the Auth Module. |
|
16
|
|
|
17
|
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`: |
|
18
|
|
|
19
|
```ts title="medusa-config.ts" |
|
20
|
import { Modules, ContainerRegistrationKeys } from "@medusajs/framework/utils" |
|
21
|
|
|
22
|
// ... |
|
23
|
|
|
24
|
module.exports = defineConfig({ |
|
25
|
// ... |
|
26
|
modules: [ |
|
27
|
{ |
|
28
|
resolve: "@medusajs/medusa/auth", |
|
29
|
dependencies: [Modules.CACHE, ContainerRegistrationKeys.LOGGER], |
|
30
|
options: { |
|
31
|
mfa: { |
|
32
|
encryption_key: process.env.AUTH_MFA_ENCRYPTION_KEY, |
|
33
|
}, |
|
34
|
providers: [ |
|
35
|
// other providers... |
|
36
|
{ |
|
37
|
resolve: "@medusajs/medusa/auth-emailpass", |
|
38
|
id: "emailpass", |
|
39
|
options: { |
|
40
|
// options... |
|
41
|
}, |
|
42
|
}, |
|
43
|
], |
|
44
|
}, |
|
45
|
}, |
|
46
|
], |
|
47
|
}) |
|
48
|
``` |
|
49
|
|
|
50
|
### Module Options |
|
51
|
|
|
52
|
<Note> |
|
53
|
|
|
54
|
The `require_verification` option was removed since Medusa [v2.16.0](https://github.com/medusajs/medusa/releases/tag/v2.16.0). Use the [authVerificationsPerActor configuration](!docs!/learn/configurations/medusa-config#httpauthVerificationsPerActor) instead. |
|
55
|
|
|
56
|
</Note> |
|
57
|
|
|
58
|
<Table> |
|
59
|
<Table.Header> |
|
60
|
<Table.Row> |
|
61
|
<Table.HeaderCell> |
|
62
|
Configuration |
|
63
|
</Table.HeaderCell> |
|
64
|
<Table.HeaderCell> |
|
65
|
Description |
|
66
|
</Table.HeaderCell> |
|
67
|
<Table.HeaderCell> |
|
68
|
Required |
|
69
|
</Table.HeaderCell> |
|
70
|
<Table.HeaderCell> |
|
71
|
Default |
|
72
|
</Table.HeaderCell> |
|
73
|
</Table.Row> |
|
74
|
</Table.Header> |
|
75
|
<Table.Body> |
|
76
|
<Table.Row> |
|
77
|
<Table.Cell> |
|
78
|
|
|
79
|
`hashConfig` |
|
80
|
|
|
81
|
</Table.Cell> |
|
82
|
<Table.Cell> |
|
83
|
|
|
84
|
An object of configurations for hashing the user's |
|
85
|
password. Refer to [scrypt-kdf](https://www.npmjs.com/package/scrypt-kdf#-hash)'s |
|
86
|
documentation for accepted options. |
|
87
|
|
|
88
|
</Table.Cell> |
|
89
|
<Table.Cell> |
|
90
|
|
|
91
|
No |
|
92
|
|
|
93
|
</Table.Cell> |
|
94
|
<Table.Cell> |
|
95
|
|
|
96
|
```ts blockStyle="inline" |
|
97
|
const hashConfig = { |
|
98
|
logN: 15, |
|
99
|
r: 8, |
|
100
|
p: 1 |
|
101
|
} |
|
102
|
``` |
|
103
|
|
|
104
|
</Table.Cell> |
|
105
|
</Table.Row> |
|
106
|
</Table.Body> |
|
107
|
</Table> |
|
108
|
|
|
109
|
--- |
|
110
|
|
|
111
|
## Related Guides |
|
112
|
|
|
113
|
- [How to register a customer using email and password](../../../../storefront-development/customers/register/page.mdx) |
|
114
|
- [Implement email verification](../../email-verification/page.mdx) |