Entra SSO auth
Hey all - does anyone have any advice or examples on how to approach adding auth with Microsoft Entra to my start app? I have achieved it fine for my client-side, using msal-browser and msal-react, but I have no idea how to keep a session in my server-side code. Ideal outcome is being able to lock down all my routes (pages and APIs), and pass on the access token to my backend APIs in the auth header, which could be called from either client or server side. Thanks!
5 Replies
multiple-amethyst•4mo ago
have you considered better-auth?
https://www.better-auth.com/docs/authentication/microsoft
Microsoft | Better Auth
Microsoft provider setup and usage.
multiple-amethyst•4mo ago
arctic works great too if you prefer to work with it a bit more manually (e.g. with lucia)
https://arcticjs.dev/providers/microsoft-entra-id
dependent-tanOP•4mo ago
Yeah I did look at better auth, but I thought it always wanted me to provide a db, which I was hoping to avoid. I’ll take another look at it though. Thanks for the link to arctic too, I’ll have a look into that as well
plain-purple•4mo ago
I used artic and I followed this example, instead of using google just replace it with entra https://github.com/webdevcody/tanstack-course-platform
GitHub
GitHub - webdevcody/tanstack-course-platform
Contribute to webdevcody/tanstack-course-platform development by creating an account on GitHub.
dependent-tanOP•4mo ago
I ended up going with better auth and just using sqlite for now. It means that every time I re-deploy my container I get a new DB, which kills old server sessions, but that's an okay compromise for now. I can get a real DB later if needed