acoustic-airline-26089
10/09/2024, 8:32 PMacoustic-airline-26089
10/10/2024, 6:36 AMacoustic-airline-26089
10/10/2024, 3:29 PMacoustic-airline-26089
10/10/2024, 3:33 PMmessage
:
"jsonnetsecure: ERROR: RUNTIME ERROR: forceResetPassword\n\t<https://storage.googleapis.com/bac-gcs-production/5b9ea6ed83ad4ae4f008900cc879253d3f7243e0279ff8b76428ae9df53ea605f616598c090af535093b7aba3df9efeb758f06f3bb7c4d98d565eb624406dcab.jsonnet:6:7-33>\tfunction <anonymous>\n\tTop-level function call\t\n"
acoustic-airline-26089
10/13/2024, 7:43 AMctx.identity
does not exist in any before hooks (at least as far as we can tell)
As for the errors, not that I am returning an error directly from the jsonnet on purpose in some cases where there's no need to make an actual network call to a webhook. It's these cases where we get the quite ugly error such as above.
Here's an example from our profile change hook that prevents users changing their email address.
function(ctx)
if std.objectHas(ctx.identity, "traits") && std.objectHas(ctx.identity.traits, "email") then
error "emailChangeForbidden"
else
error "cancel"
acoustic-airline-26089
10/13/2024, 2:47 PMctx
.acoustic-airline-26089
10/13/2024, 2:51 PM"flow": {
"expires_at": "2024-10-13T15:08:55.025083Z",
"active": "code",
"return_to": "/auth/new-password",
"id": "af36ed50-d1a6-4f80-9f7f-d59e7355ec05",
"state": "passed_challenge",
"type": "browser",
"issued_at": "2024-10-13T14:38:55.025083Z",
"request_url": "<https://foobar.projects.oryapis.com/self-service/recovery/browser?return_to=%2Fauth>"
}
(except for our own return_to
url of course but that doesnt' seem the most reliable.acoustic-airline-26089
10/13/2024, 3:14 PMgray-library-49237
10/13/2024, 6:19 PMctx.identity
does not exist in any before hooks (at least as far as we can tell)
yes this is true. But sadly i do not have a complete sample of each steps.
> e.g. we get a ctx like this for a password reset but it's not clear how to know if this is specifically for password reset or not:
Having a dedicated webhook endpoint that handles only reacting to password change can help.
this endpoint will be hooked to the after password settings flow. Checking the active
and state
could be sufficient to determine a successful password change.gray-library-49237
10/13/2024, 6:23 PMgray-library-49237
10/13/2024, 6:27 PMacoustic-airline-26089
10/13/2024, 6:30 PMmetadata_public
which will prevent them logging in until they have successfully reset their password.
The login we can block just from jsonnet, but I don't think we can remove or change the flag just from the jsonnet - we have to make the webhook call to our api which uses the admin api to remove the flag.
It's just a shame we can't do all of that on the Ory side and not have potentially unreliable network calls in the middle.acoustic-airline-26089
10/13/2024, 6:31 PMgray-library-49237
10/13/2024, 11:36 PM