Next.js Discord

Discord Forum

How to set a bearer token in all requests?

Unanswered
(-.-) posted this in #help-forum
Open in Discord
I need to set a bearer token in all requests in my application, can I use the middleware for this? Do you have any example?

5 Replies

Polar bear
I'm using axios
I built my own api client with axios using these interceptors
Wouldn't it be bad practice to store the token in localStorage?
Polar bear
yep, I'm implementing this part right now