why is x-access-token header used for

0 votes
Can anyone explain this?
Jun 27, 2019 in Others by shubham
• 7,320 points
9,191 views

1 answer to this question.

0 votes

To understand this we need to understand what is authentication?

Authentication is basically used to identify who you are. The basic Authentication includes username and password, which is used to identify who you are. But as we know that our HTTP is stateless we need to keep track of things to know what the user is doing. For example: An online shopping company, need to keep track of what your user is getting in each page or Online game should keep track on still which level the user has reached.

So to make that possible we make use of token, what token does it take your data and secret like 

jwt.sign(payload, secretOrPrivateKey, [options, callback])

and gives back a token which consists of three parts 

header: consist of the type of algorithm used to create the signature

payload: consist of data

signature: which consist of the encrypted part of the header and payload separated by a period

The best part of JWT is it lets you store the token in client side

So to send the token generated to the client side, we use the header X-access-token. For further sessions, this token is exchanged, not the username/password.

answered Jun 27, 2019 by sunshine
• 1,280 points

Related Questions In Others

0 votes
0 answers

explain what access modifier can be used for method

Sep 10, 2019 in Others by anonymous
83 views
0 votes
2 answers

Is Peterson’s Algorithm a good solution for Critical Section problem? If yes, then why? If no, then why?

Peterson’s solution provides a good algorithmic description ...READ MORE

answered Jul 6, 2020 in Others by Gitika
• 65,910 points
627 views
0 votes
0 answers

why linux is more secure than windows?

which features make linux more secure than ...READ MORE

Jul 11, 2018 in Others by kristena1234
• 160 points
134 views
0 votes
1 answer

why linux is more secure than any other operating system?

First thing i would like to tell ...READ MORE

answered Jul 11, 2018 in Others by kristena1234
• 160 points
1,085 views
0 votes
0 answers

why is x-access-token header used for?

Can anyone explain this? READ MORE

Jun 27, 2019 in Others by shubham
• 7,320 points
267 views
0 votes
1 answer

What does cors means in Angularjs and what the use of it?

CORS is Cross Origin Resource Sharing which means you ...READ MORE

answered Jan 29, 2020 in Web Development by kartik
• 37,520 points
2,184 views
0 votes
1 answer

how to safely deploy npm install without it causing inconsistencies?

The recent versions on npm generates a ...READ MORE

answered Apr 11, 2018 in DevOps on Cloud by DareDev
• 6,890 points
191 views
0 votes
2 answers

Send HTTP request in Java

import com.google.api.client.http.GenericUrl; import com.google.api.client.http.HttpRequest; import com.google.api.client.http.HttpResponse; import com.google.api.client.http.HttpTransport; import com.google.api.client.http.javanet.NetHttpTransport; import java.io.IOException; import ...READ MORE

answered Aug 3, 2018 in Java by samarth295
• 2,220 points
678 views
0 votes
1 answer

Why do we use Body-parser in Node.js?

For understanding this first you need to ...READ MORE

answered May 20, 2019 in Others by sunshine
• 1,280 points
5,343 views
0 votes
1 answer

What is a callback function?

Callback function is a function which is ...READ MORE

answered Jun 12, 2019 in Others by sunshine
• 1,280 points
275 views