fix: fallback identity email#377
Conversation
c03d0be to
e8b00f2
Compare
jonas-jonas
left a comment
There was a problem hiding this comment.
Apologies for the late review. What's the use case here? To me, this seems like an unlikely use case. This would catch situations where the identity schema doesn't define any verifiable addresses. Is that correct?
If so, what's the reason for configuring it that way?
|
Hi @jonas-jonas, This PR ensures that when the |
|
e.g.: "verifiable_addresses": [
{
"id": "66cdce7c-32c8-2399-991b-539e1e4d0da7",
"value": "******@ory.sh",
"verified": false,
"via": "email",
"status": "sent",
"created_at": "2025-09-23T18:29:19.776434Z",
"updated_at": "2025-09-23T18:29:19.776434Z"
}
], |
|
I agree with @jonas-jonas and it would definitely be better to use verified addresses here per default, since this is a example / reference implementation. If you have custom needs for your use case you can always fork it / use it as the baseline or go with https://github.com/ory/elements :) |
This pull request introduces a fallback mechanism in the
extractSessionfunction withinsrc/routes/consent.ts. The change ensures that if no email is found in the session'sid_token, the email fromidentity.traitsis used as a backup, withemail_verifiedexplicitly set tofalsewhen the email's verification status cannot be guaranteed.Key change:
src/routes/consent.ts: Added a fallback to populatesession.id_token.emailwith the email fromidentity.traitsif no email is found, and setemail_verifiedtofalsein such cases.Related Issue or Design Document
Checklist
If this pull request addresses a security vulnerability,
I confirm that I got approval (please contact security@ory.sh) from the maintainers to push the changes.
Further comments