I want to allow only the allowed users to signup, ...
# talk-kratos
e
I want to allow only the allowed users to signup, i have a webhook that checks if the user's is in internal_release_allowed_users table to return 200, otherwise return 404. But when i visit the registration page i am getting error. Getting the following error while trying to use web hook before registration:
Copy code
{
  "id": "572307bf-4c4b-4f31-a7ad-e027a3c83873",
  "error": {
    "code": 500,
    "status": "Internal Server Error",
    "message": "Error: failed to evaluate snippet: RUNTIME ERROR: Field does not exist: identity\n\<tbase64://ZnVuY3Rpb24oY3R4KSB7IAogICAgZW1haWw6IGN0eC5pZGVudGl0eS50cmFpdHM>uZW1haWwsCiAgIG5hbWU6IGN0eC5pZGVudGl0eS50cmFpdHMubmFtZSwKIH0KCgo=:2:12-24\t\n\tField \"email\"\t\n\tDuring manifestation\t\n\nUsage:\n  kratos jsonnet [flags]\n\nFlags:\n  -h, --help   help for jsonnet\n\nfailed to evaluate snippet: RUNTIME ERROR: Field does not exist: identity\n\<tbase64://ZnVuY3Rpb24oY3R4KSB7IAogICAgZW1haWw6IGN0eC5pZGVudGl0eS50cmFpdHM>uZW1haWwsCiAgIG5hbWU6IGN0eC5pZGVudGl0eS50cmFpdHMubmFtZSwKIH0KCgo=:2:12-24\t\n\tField \"email\"\t\n\tDuring manifestation\t\n\n: exit status 1"
  },
  "created_at": "2023-03-19T10:46:00.986Z",
  "updated_at": "2023-03-19T10:46:00.986Z"
}
this is my jsonnet:
Copy code
function(ctx) { 
    email: ctx.identity.traits.email,
    name: ctx.identity.traits.name,
 }
this is my config:
Copy code
registration:
      lifespan: 10m
      ui_url: <http://127.0.0.1:3000/registration>
      before:
        hooks:
          - hook: web_hook
            config:
              url: <http://host.docker.internal:4000/api/v1/web-hooks/ory-identities/check-user-in-invite>
              method: POST
              body: <base64://ZnVuY3Rpb24oY3R4KSB7IAogICAgZW1haWw6IGN0eC5pZGVudGl0eS50cmFpdHM>uZW1haWwsCiAgIG5hbWU6IGN0eC5pZGVudGl0eS50cmFpdHMubmFtZSwKIH0KCgo=
      after:
        password:
          hooks:
            - hook: session
i found that the identity is not created until the submit button is clicked, if i move the webhook to the after section it works by giving error, but i want that only the users which are available in internal release list, should be able to access it. If i put the webhook in the after section the user is anyways created even when the webhook gives error and if you put it in before section, you wont have the user email as it is executed before the flow is created. @magnificent-energy-493 any idea on how to achieve this functionality? where only the internal user are allowed to be registered (create identity only if they are internal user)
Copy code
I[#/selfservice/flows/registration/after] S[#/properties/selfservice/properties/flows/properties/registration/properties/after/$ref] doesn't validate with "#/definitions/selfServiceAfterRegistration"
  I[#/selfservice/flows/registration/after/password] S[#/definitions/selfServiceAfterRegistration/properties/password/$ref] doesn't validate with "#/definitions/selfServiceAfterRegistrationMethod"
    I[#/selfservice/flows/registration/after/password/hooks/0] S[#/definitions/selfServiceAfterRegistrationMethod/properties/hooks/items/anyOf] anyOf failed
      I[#/selfservice/flows/registration/after/password/hooks/0] S[#/definitions/selfServiceAfterRegistrationMethod/properties/hooks/items/anyOf/0/$ref] doesn't validate with "#/definitions/selfServiceSessionIssuerHook"
        I[#/selfservice/flows/registration/after/password/hooks/0] S[#/definitions/selfServiceSessionIssuerHook] validation failed
          I[#/selfservice/flows/registration/after/password/hooks/0/hook] S[#/definitions/selfServiceSessionIssuerHook/properties/hook/const] value must be "session"
          I[#/selfservice/flows/registration/after/password/hooks/0] S[#/definitions/selfServiceSessionIssuerHook/additionalProperties] additionalProperties "config" not allowed
      I[#/selfservice/flows/registration/after/password/hooks/0] S[#/definitions/selfServiceAfterRegistrationMethod/properties/hooks/items/anyOf/1/$ref] doesn't validate with "#/definitions/selfServiceWebHook"
        I[#/selfservice/flows/registration/after/password/hooks/0/config/response] S[#/definitions/selfServiceWebHook/properties/config/properties/response/additionalProperties] additionalProperties "parse" not allowed
getting this error when setting response parse to true