I thought of a few approaches myself:
- Use cookies. This requires CSRF protection and some logic complications as one needs to unify the cookie for both API and main domain. Also cookies seem a bit creepy regarding security overall
- Render auth-related stuff on client. Well this would work but things as simple as the navbar, which should hide SignIn/SignUp buttons when authed, is auth related. With some overview of my existing application, SSR entirely looks pointless at that point.
What is the better approach to this? Something that's secure and practical?
Edit: I would highly appreciate a comment describing the reason for downvoting. I'm providing a bounty for a definitive answer that answers questions like this and this plus a lot of issues posted on GitHub and threads posted on different framework-specific forums.