-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Expand file tree
/
Copy pathauth_verification_request.yaml
More file actions
107 lines (102 loc) · 3.95 KB
/
Copy pathauth_verification_request.yaml
File metadata and controls
107 lines (102 loc) · 3.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
post:
operationId: PostVerificationRequest
summary: Request Customer Verification
x-sidebar-summary: Request Verification
description: >-
Create a verification request for a customer. This API route is used when a
customer logs in, but their email requires verification. It can also be used
for custom flows, such as phone number verification. Once successfully
requested, a verification code will be generated and an
`auth.verification_requested` event will be emitted. You can listen to this
event and decide how to deliver the code to the customer.
externalDocs:
url: >-
https://docs.medusajs.com/resources/storefront-development/customers/verify-account
description: 'Storefront guide: Register Customer with Email Verification.'
x-authenticated: false
parameters: []
requestBody:
content:
application/json:
schema:
type: object
description: The verification request details
required:
- entity_id
- entity_type
- code_provider
properties:
entity_id:
type: string
title: entity_id
description: >-
The identifier of the user or customer. For example, an email
address.
entity_type:
type: string
title: entity_type
description: >-
The type of identity being verified. For example, "email" or
"phone_number".
code_provider:
type: string
title: code_provider
description: >-
The provider to use to create the verification token or code. By
default, Medusa provides a `token` provider that generates a
random token. You can also implement your own provider to
generate a code or OTP.
metadata:
type: object
description: >-
Custom key-value pairs that can be passed to the verification
request. This is optional and can be used to store additional
information related to the verification request.
x-codeSamples:
- lang: Shell
label: cURL
source:
$ref: ../code_samples/Shell/auth_verification_request/post.sh
tags:
- Auth
responses:
'201':
description: OK
'400':
$ref: ../components/responses/400_error.yaml
'401':
$ref: ../components/responses/unauthorized.yaml
'404':
$ref: ../components/responses/not_found_error.yaml
'409':
$ref: ../components/responses/invalid_state_error.yaml
'422':
$ref: ../components/responses/invalid_request_error.yaml
'500':
$ref: ../components/responses/500_error.yaml
x-workflow: requestVerificationWorkflow
x-events:
- name: auth.verification_requested
payload: |-
```ts
{
entity_id, // The identifier of the entity being verified. For example, an email address.
entity_type, // The kind of entity being verified. For example, "email".
code_provider, // The verification provider that generated the code. For example, "token".
auth_identity_id, // The ID of the auth identity being verified.
code, // The generated verification code.
expires_at, // (Date) The code expiry date.
metadata, // (object) Optional custom metadata passed from the request.
}
```
description: >-
Emitted when a verification code is generated. You can listen to
this event and decide how to deliver the code to the user or customer.
The payload changed in v2.17.0:
`actor_type` and `provider_identity_id` were removed,
`provider` was renamed to `code_provider`, and `entity_type` was added.
Subscribers written before v2.17.0 must be updated to use the payload
below.
deprecated: false
since: 2.15.5
x-since: 2.16.0