7

How to send the authorization header using Axios

 3 years ago
source link: https://dev.to/jewelcse/how-to-send-the-authorization-header-using-axios-a70
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

How to send the authorization header using Axios

Jul 20

・1 min read

Axios is mostly used javascript promise-based HTTP client for end-to-end requesting resources from the serve side application. Generally, in simple application we don’t have to put the header for any get or post request. but most of the cases, security is a big issue sometimes we need to add authorization header to get resources from the server or save resource to the server. That’s why we need to add the headers with request.

So, let’s create a header object according you needs:

const token = "your_token"

let headers = {
"Content-type": "application/json; charset=UTF-8",
"Authorization": 'Bearer ' + token
};

Learn more: https://codesnipeet.com/how-to-send-the-authorization-header-using-axios/


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK