I was studying some approaches to implement a traditional authentications on Next. In my brainstorms I found a solution that the user need be authenticate only on the first server-side rendering, once a time that every requests on client-side can return a Not Authenticate (403) error to be treated later with a redirect.
Can you guys think another approaches for that?
This is what i do:
Thanks @davibe for helping out! For the sake of having help from the community in one place, I'm forwarding you here: #153 and closing this thread.
@davibe would love it if you could replicate your message there if you haven't yet.
Thanks again!
hi @davibe i am saving my auth token in localstorage and then adding in headers from there but when server side request goes it did not set my autherization header.
Can you please suggest me some other way to set headers
If you set it as a cookie the server can read that cookie form headers. Have a look at how cookies work.
Most helpful comment
This is what i do: