1 /**
2 * @oas [post] /auth/mfa/recovery-codes
3 * operationId: PostMfaRecoveryCodes
4 * summary: Generate Multi-Factor Authentication (MFA) Recovery Codes
5 * x-sidebar-summary: Generate MFA Recovery Codes
6 * description: |
7 * Generate a new set of single-use recovery codes for the authenticated user. Recovery codes can
8 * be used to verify MFA challenges when the user does not have access to their primary MFA
9 * factor. Generating new codes replaces any previously issued codes, so they should be stored in
10 * a safe place. At least one enabled MFA factor is required to generate recovery codes.
11 * x-authenticated: false
12 * requestBody:
13 * content:
14 * application/json:
15 * schema:
16 * type: object
17 * description: The options to use when generating recovery codes.
18 * properties:
19 * count:
20 * type: number
21 * title: count
22 * description: The number of recovery codes to generate. Must be between 1 and 50. Defaults to the provider's configured value when omitted.
23 * x-codeSamples:
24 * - lang: JavaScript
25 * label: JS SDK
26 * source: |-
27 * import Medusa from "@medusajs/js-sdk"
28 *
29 * export const sdk = new Medusa({
30 * baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
31 * debug: import.meta.env.DEV,
32 * auth: {
33 * type: "session",
34 * },
35 * })
36 *
37 * const { recovery_codes } = await sdk.auth.mfa.generateRecoveryCodes()
38 * - lang: Shell
39 * label: cURL
40 * source: curl -X POST '{backend_url}/auth/mfa/recovery-codes'
41 * tags:
42 * - Mfa
43 * responses:
44 * "200":
45 * description: OK
46 * "400":
47 * $ref: "#/components/responses/400_error"
48 * "401":
49 * $ref: "#/components/responses/unauthorized"
50 * "404":
51 * $ref: "#/components/responses/not_found_error"
52 * "409":
53 * $ref: "#/components/responses/invalid_state_error"
54 * "422":
55 * $ref: "#/components/responses/invalid_request_error"
56 * "500":
57 * $ref: "#/components/responses/500_error"
58 * x-since: 2.15.3
59 *
60 */
61