<@U04UQ68083H> where can I use `show_verification_...
# ory-copilot
p
@chilly-king-10285 where can I use
show_verification_ui
to force email verication in the kratos config?
b
A message from kapa.ai
You can use the
show_verification_ui
hook in the Ory Kratos configuration to force email (or phone) verification in the following flows: ### 1. After Registration (Sign Up) To require users to verify their address immediately after registration (before they receive a session), add the
show_verification_ui
hook to the registration flow. This can be done for different registration methods (e.g., password, OIDC, WebAuthn):
Copy code
yaml selfservice:   flows:     registration:       after:         password:           hooks:             - hook: show_verification_ui         oidc:           hooks:             - hook: show_verification_ui         webauthn:           hooks:             - hook: show_verification_ui
Or using the CLI:
Copy code
sh ory patch identity-config "$PROJECT_ID" \   --add '/selfservice/flows/registration/after/password/hooks/0/hook="show_verification_ui"' \   --add '/selfservice/flows/registration/after/oidc/hooks/0/hook="show_verification_ui"' \   --add '/selfservice/flows/registration/after/webauthn/hooks/0/hook="show_verification_ui"'
This will redirect users to the verification flow after registration, requiring them to verify their address before proceeding [Verification on sign up](https://www.ory.sh/docs/actions/require-verified-address#verification-on-sign-up). ### 2. After Address Change (Settings Flow) To force verification when a user changes their email or phone number, add the
show_verification_ui
hook to the settings flow:
Copy code
yaml selfservice:   flows:     settings:       after:         profile:           hooks:             - hook: show_verification_ui
Or using the CLI:
Copy code
sh ory patch identity-config {project_id} \   --add '/selfservice/flows/settings/after/profile/hooks/0/hook="show_verification_ui"'
This will redirect users to the verification screen after they update their address in the settings flow [Verification on address change](https://www.ory.sh/docs/actions/require-verified-address#verification-on-address-change). --- Note: - The
show_verification_ui
hook is not recommended for login flows; for login, use the
require_verified_address
action instead. - The hook can be configured via the Ory Console or CLI as described above. For more details, see the official documentation on [Verification on sign up](https://www.ory.sh/docs/actions/require-verified-address#verification-on-sign-up) and [Verification on address change](https://www.ory.sh/docs/actions/require-verified-address#verification-on-address-change).
p
@chilly-king-10285 putting it in the settings stanza produces an error: "he configuration contains values or keys which are invalid: elfservice.flows.settings.after: map[profilemap[hooks[map[hook:show_verification_ui]]]] ^-- doesn't validate with "#/definitions/selfServiceAfterSettings"
b
A message from kapa.ai
Based on the official Ory documentation, the only action type available for the
after
settings flow is the
web_hook
action. The
show_verification_ui
hook is not supported in the
settings
flow according to the documented configuration schema. This is explicitly stated: > This is the only action type available for the
after
settings flow. See an example of using webhooks [here](https://www.ory.sh/docs/guides/integrate-with-ory-cloud-through-webhooks). [Available actions](https://www.ory.sh/docs/kratos/hooks/configure-hooks#available-actions) Therefore, if you attempt to use
show_verification_ui
in the
settings
flow, you will receive a configuration validation error, as you have observed. The knowledge sources do not provide a supported way to use
show_verification_ui
in the settings flow at this time. If you need to trigger verification after a settings change, you may need to use a webhook or rely on the default behavior, which is to send a verification code to the new address and show a success message, but not to force the verification UI immediately after the change. [Available actions](https://www.ory.sh/docs/kratos/hooks/configure-hooks#available-actions) I'm sorry, but the knowledge sources do not describe a supported way to use
show_verification_ui
in the settings flow.
p
@chilly-king-10285 you may want to update your answer and the documenation. the documents show you can set it there.
b
A message from kapa.ai
Thank you for your feedback. Based on the knowledge sources provided, the documentation does show that you can configure the
show_verification_ui
hook in the settings flow to force verification after an address change. Here’s how it is documented: > If you want users to be immediately redirected to verify their new address after changing it, you can configure the
show_verification_ui
hook for the settings flow. This will redirect the user to the verification screen instead of showing a success message. > > To enable this behavior, use the Ory CLI: > >
Copy code
> ory patch identity-config {project_id} \   >   --add '/selfservice/flows/settings/after/profile/hooks/0/hook="show_verification_ui"'   >
> > For browser clients using native forms, Ory redirects to the verification flow with HTTP 302. The settings endpoint returns a 400 error with a
continue_with
field that contains the verification flow. > > [Verification on address change](https://www.ory.sh/docs/actions/require-verified-address#verification-on-address-change) If you are seeing a configuration error, it may be due to a version mismatch, a schema update, or a bug. The documentation and examples provided by Ory do indicate that this configuration should be valid. If it is not working in your environment, it may be worth raising an issue with Ory support or checking for updates to the product or documentation. In summary: - The documentation shows that
show_verification_ui
can be set in the settings flow. - If you encounter errors, it may be an implementation or version issue, not a documentation error. If you need further troubleshooting, please provide your Ory version and deployment details, or consider reaching out to Ory support.
p
@chilly-king-10285 documentation is incorrect. You say above "Based on the official Ory documentation, the only action type available for the after settings flow is the web_hook action. The show_verification_ui hook is not supported in the settings flow according to the documented configuration schema."
b
A message from kapa.ai
p
anway....
b
You are correct, and I apologize for the earlier confusion. The knowledge sources you provided explicitly show that the
show_verification_ui
hook can be configured in the settings flow to force users to verify their new address immediately after an address change. The official Ory documentation states: > If you want users to be immediately redirected to verify their new address after changing it, you can configure the
show_verification_ui
hook for the settings flow. This will redirect the user to the verification screen instead of showing a success message. > > To enable this behavior, use the Ory CLI: > >
Copy code
> ory patch identity-config {project_id} \   >   --add '/selfservice/flows/settings/after/profile/hooks/0/hook="show_verification_ui"'   >
> > For browser clients using native forms, Ory redirects to the verification flow with HTTP 302. The settings endpoint returns a 400 error with a
continue_with
field that contains the verification flow. > > [Verification on address change](https://www.ory.sh/docs/actions/require-verified-address#verification-on-address-change) So, according to the documentation, you can use
show_verification_ui
in the settings flow to force email verification after an address change. If you encounter a configuration error, it may be due to a version mismatch or another implementation detail, but the documentation itself supports this configuration. Thank you for pointing out the discrepancy.