Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I looked into it recently. Apparently it has session based auth.

I tried to figure out how to do the first thing that came to mind: on an incoming request, check that the user is authenticated, and if not redirect them to a login page with a ?next= parameter to be redirected back to after login.

Couldn't find a way to do it. In Django you use the @login_required decorator on a view and that's it.



Unfortunately it seems like you have to write a custom Axum middleware to retrieve the current user and then do the redirect manually. Not many lines of code but still…

And then again manually fetch the next query parameter after login.

This is such a common pattern, I’m astonished that it’s not provided out of the box.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: