Skip to content

Commit 0db1b91

Browse files
authored
feat: add docs for verification after login (#1692)
1 parent ff051ef commit 0db1b91

File tree

2 files changed

+80
-3
lines changed

2 files changed

+80
-3
lines changed

docs/identities/sign-in/actions.mdx

Lines changed: 78 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ created account to get access to your services, but instead can access all the f
133133

134134
## Show verification after successful registration
135135

136-
If you want to show the verification screen after registration, follow these steps:
136+
If you want to show the verification screen after registration or login, follow these steps:
137137

138138
```mdx-code-block
139139
<Tabs>
@@ -201,3 +201,80 @@ verification is enabled and the identity schema defines at least one verifiable
201201
</TabItem>
202202
</Tabs>
203203
```
204+
205+
## Show verification after login if address is not verified yet
206+
207+
If you want to show the verification screen after login, if any of the user's addresses are not verified yet, add the
208+
`verification` hook to the login after hooks.
209+
210+
Using the [Ory CLI](../../guides/cli/01_installation.mdx):
211+
212+
```shell
213+
ory patch identity-config {project_id} \
214+
--add '/selfservice/flows/registration/after/password/hooks=[{"hook": "verification"}]' \
215+
--add '/selfservice/flows/registration/after/oidc/hooks=[{"hook": "verification"}]' \
216+
--add '/selfservice/flows/registration/after/webauthn/hooks=[{"hook": "verification"}]'
217+
```
218+
219+
To automatically show the verification screen in server rendered browser flows, add the `show_verification_ui` hook as well:
220+
221+
```mdx-code-block
222+
<Tabs>
223+
<TabItem value="Server rendered browser client">
224+
```
225+
226+
Using the [Ory CLI](../../guides/cli/01_installation.mdx):
227+
228+
```shell
229+
ory patch identity-config {project_id} \
230+
--add '/selfservice/flows/registration/after/password/hooks=[{"hook": "show_verification_ui"}]' \
231+
--add '/selfservice/flows/registration/after/oidc/hooks=[{"hook": "show_verification_ui"}]' \
232+
--add '/selfservice/flows/registration/after/webauthn/hooks=[{"hook": "show_verification_ui"}]'
233+
```
234+
235+
:::note
236+
237+
If your identity schema defines multiple verifiable addresses, Ory Identities redirects to the verification flow of only one of
238+
the addresses.
239+
240+
:::
241+
242+
```mdx-code-block
243+
</TabItem>
244+
<TabItem value="SPA & Native clients">
245+
```
246+
247+
For SPA and native clients, the response from the registration endpoint contains a `continue_with` field. This field lists
248+
possible actions, the user might need to or can take next. For example, an object containing the ID of the verification flow
249+
created as part of the registration flow:
250+
251+
```json
252+
{
253+
"continue_with": [
254+
{
255+
"action": "show_verification_ui",
256+
"flow": {
257+
"id": "d859f6af-1dfe-453e-9320-d572e10edeea",
258+
"verifiable_address": "[email protected]"
259+
}
260+
}
261+
// Other items
262+
]
263+
}
264+
```
265+
266+
You can use this ID to fetch the verification flow information, using the
267+
[`getVerificationFlow`](../../reference/api#tag/frontend/operation/getVerificationFlow) API method.
268+
269+
:::note
270+
271+
The response from the registration endpoint always contains the `continue_with` field with the `verification_ui` action, if
272+
verification is enabled and the identity schema defines at least one verifiable address. Because of this, the
273+
`show_verification_ui` hook has no effect for API and SPA clients.
274+
275+
:::
276+
277+
```mdx-code-block
278+
</TabItem>
279+
</Tabs>
280+
```

docs/kratos/self-service/flows/verify-email-account-activation.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ To configure account verification, go to **Authentication** → **Email Verifica
6666

6767
:::caution
6868

69-
For SMS verification to work, you'll also need to configure a `courier_channel` with the ID set to `sms` via the CLI. See the
70-
**Ory CLI** tab for more information.
69+
For SMS verification to work, you'll also need to configure a courier channel with the ID set to `sms` via the CLI. See the
70+
[courier documentation](../../emails-sms/10_sending-sms.mdx) for more information.
7171

7272
:::
7373

0 commit comments

Comments
 (0)