Skip to main content

SlashLogs

Tag: jwt

How to inject authorization header on all axios requests

While using a frontend client like React you often find yourself calling the backend and using the same code to give axios a JsonWebToken or an Api Key to authorize the client and fulfill the request in the backend code. Instead of passing the authorization token you can handle and instruct axios to save you from that boilerplate code. Axios is a very usefull http client library that can make a lot for us.