<@U04UQ68083H> which webhook should i use to see i...
# ory-copilot
b
@chilly-king-10285 which webhook should i use to see if a user is allowed to sign up, and possibly block it? And can I also do that check with oidc users?
b
A message from kapa.ai
To check if a user is allowed to sign up and potentially block the registration, you should use a flow-interrupting webhook in the registration flow. This type of webhook allows you to perform custom validation (such as checking email domains, IP addresses, invite codes, etc.) and interrupt the registration if the conditions are not met. You can configure this by setting the webhook's
response.parse
property to
true
. This way, if your external service returns a 4xx or 5xx HTTP status code, the registration flow will be interrupted and the user will not be able to sign up. Here’s an example configuration:
Copy code
yaml - hook: web_hook   config:     response:       parse: true     url: <https://your-validation-service/validate>     method: POST     body: base64://{YOUR_JSONNET_PAYLOAD}
This webhook can be added to the
after
registration flow, and you can define it for specific authentication methods (like
password
,
oidc
, etc.) or for all methods. Yes, you can also perform this check for OIDC users. Ory allows you to define hooks for different authentication methods, including OIDC, so you can apply the same validation logic to users signing up via OIDC providers by adding the webhook under the
oidc
method in your registration flow configuration. This is described in the documentation: > You can further customize the behavior of the system by defining what action to trigger based on the authentication method used to sign in, register, and update user settings. > ... > | Authentication method | Description | > | --- | --- | > |
password
| Sign-in and sign-up with username/email and password combo. | > |
oidc
| Sign-in and sign-up through OIDC-compliant OAuth2 identity providers. | [Actions in Ory Identities](https://www.ory.sh/docs/kratos/hooks/configure-hooks#action-triggers) For more details and examples, see the [flow-interrupting webhooks documentation](https://www.ory.sh/docs/guides/integrate-with-ory-cloud-through-webhooks#flow-interrupting-webhooks) and the [customize login and registration behavior guide](https://www.ory.sh/docs/identities/sign-in/actions#customize-login-and-registration-behavior).