2023-05-26

How can I implement basic authentication between Next.JS and DRF using JWT?

I am trying to recode the website for my student club and would need some assistance regarding authentication. I do have a Django Backend setup with all the necessary data (e.g. Member infos, etc.) and would like to display them on the frontend (name + position) and on the Backend (email, phone number, etc.). Now to achieve that I would need basic authentication where I can give out login credentials to the members and they can login (no sign up from the website). Now I am wondering how to do that; coming from Django I would generate a credential pair and the authentication would go via JWT, but I cant find a suitable example (everything is very old). Right now my setup looks like this:

  • Django Backend with JWT
  • Next.JS frontend (typescript, tailwind css) with seperate login page

I was looking at next-auth which seems promising but I am afraid that login via Socials is not my usecase. Can anyone provide more information how to setup Django with Next.JS with authentication? Cheers

I already tried using Next-Auth with some examples provided on the internet but none of them worked/ were deprecated.



No comments:

Post a Comment