Next.js Discord

Discord Forum

Next js and django restframework

Unanswered
Masai Lion posted this in #help-forum
Open in Discord
Masai LionOP
Hello, I would like to shed some light on APIs and authentication. I have an endpoint in django restframework for authentication, it returns a JWT token if the user is logged in, I wonder where I can keep this token when the user does CRUD actions, is this a good thing to do this also for authentication?

7 Replies

Masai LionOP
I also emphasize that for each page navigation, if the user wishes for example to add something, in the post request I must have their access token
yeah, you could use next-auth which also store the token in a httponly cookies
@Masai Lion it is safe and secure ?
httpOnly cookie are secure only in Application layer because they can't be accessed by client-side javascript browser.

JWT are also making sure that the content can't be tampered even if the cookies are somehow snipped in the browser.
Masai LionOP
okay super, im trying