Raw
1 post:
2 operationId: PostMfaRecoveryCodes
3 summary: Generate Multi-Factor Authentication (MFA) Recovery Codes
4 x-sidebar-summary: Generate MFA Recovery Codes
5 description: >
6 Generate a new set of single-use recovery codes for the authenticated user.
7 Recovery codes can
8
9 be used to verify MFA challenges when the user does not have access to their
10 primary MFA
11
12 factor. Generating new codes replaces any previously issued codes, so they
13 should be stored in
14
15 a safe place. At least one enabled MFA factor is required to generate
16 recovery codes.
17 x-authenticated: true
18 externalDocs:
19 description: Learn more about MFA in Medusa
20 url: https://docs.medusajs.com/resources/commerce-modules/auth/mfa
21 parameters: []
22 requestBody:
23 content:
24 application/json:
25 schema:
26 type: object
27 description: The options to use when generating recovery codes.
28 properties:
29 count:
30 type: number
31 title: count
32 description: >-
33 The number of recovery codes to generate. Must be between 1 and
34 50. Defaults to the provider's configured value when omitted.
35 x-codeSamples:
36 - lang: JavaScript
37 label: JS SDK
38 source:
39 $ref: ../code_samples/JavaScript/auth_mfa_recovery-codes/post.js
40 - lang: Shell
41 label: cURL
42 source:
43 $ref: ../code_samples/Shell/auth_mfa_recovery-codes/post.sh
44 tags:
45 - Multi-Factor Authentication
46 responses:
47 '200':
48 description: OK
49 '400':
50 $ref: ../components/responses/400_error.yaml
51 '401':
52 $ref: ../components/responses/unauthorized.yaml
53 '404':
54 $ref: ../components/responses/not_found_error.yaml
55 '409':
56 $ref: ../components/responses/invalid_state_error.yaml
57 '422':
58 $ref: ../components/responses/invalid_request_error.yaml
59 '500':
60 $ref: ../components/responses/500_error.yaml
61 x-since: 2.15.3