How to get current username & user email when using cloudFlare zero trust application

Hi I am using Cloudflare zero trust application. How can I get username & email for current login user when they are login by One-time PIN login?

Is there any way to get the current user profile in my self-host web application?

Hey Vince,

I do not know what the username should be with a one-time PIN login, but you can get the email the logged in user used server-side via the header Cf-Access-Authenticated-User-Email.

See an explanation and code example at Securing a Single Page Application (SPA) behind "Cloudflare Access" - #2 by Judge

hope that helps!

Michael