Accessing user before render with Netlify Identity

I am using Netlify Identity with Astro and Vanilla JS. I am wanting to access the user information before the page renders, that way I can use this information to render parts of my Astro page.

I can not figure out how to do this, without first sending in the Barier token accessed with the netlifyIdentiy widget client side. This means the page has already loaded, then I have to send the request, which is not ideal.

Is there a way I can get this information with a Netlify Function (or other method) before I even render the page?

I’m not familiar with that and I don’t have documentation for that. you can I think create a function that can fetch this but there isn’t a clear outline that i’m aware of to accomplish your intended goals. You can of course search the forums or stack overflow?