Skip to content
Discussion options

You must be logged in to vote

Yes, you can read the email from the current Kratos session, but the session cookie itself will not directly give you the email. The cookie is opaque. You need to call Kratos’ session endpoint, usually toSession or /sessions/whoami, from your app and then read the identity data from the returned session.

For example, the email is usually available from either the identity traits or the verifiable addresses:

const session = await ory.toSession();

const email =
  session.data.identity?.verifiable_addresses?.find(
    (address) => address.via === "email" && !address.verified,
  )?.value ??
  session.data.identity?.traits?.email;

Then you can prefill the verification form in your own UI.

The…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@vinckr
Comment options

Answer selected by vinckr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants