Hey there! This post is for my front-end app while building Codemarka and a good practice I adopted and you should too. THE PROBLEM: On my server, I've got routes that are protected. To access them you'll need to provide an auth token in the reques...

Markdown supported · ⌘↵ to post
Quite a neat method. Axios has a way of setting the authorization token once, globally. By using
axios.defaults.headers.common['Content-Type'] = 'application/json';
axios.defaults.headers.common['Authorization'] = `Bearer ${access_token}`;
Check this StackOverflow answer for more info.
Rahul Singh
Being human in the age of Alogorithm
Love this ❤️ I would love to hear your thoughts on 4 Programming Language That Will Dominate 2021