Authentication with Axum
mattrighetti
created: June 4, 2025, 11:33 p.m. | updated: June 5, 2025, 6:43 p.m.
Authentication with AxumMay 3, 2025Consider this scenario: you’re building a website that has a classic navbar at the top, this navbar has a button that reflects the user authentication status, showing a "Profile" button if the user is authenticated and showing a "Login" button in case the user is unauthenticated.
I’d argue the simplest way to handle user authentication if you’re doing SSR is using cookies.
To level up the cookie-based authentication we’ve discussed, authentication middleware offers a cleaner, reusable way to validate cookies and secure routes.
With that in mind, let’s try and create our authentication middleware.
/// /// This middleware performs JWT-based authentication by checking for `jwt` and `refresh` cookies.
3 days, 8 hours ago: Hacker News: Front Page