A
A
Alexey Dzyuba2017-12-10 13:48:35
JSON Web Token
Alexey Dzyuba, 2017-12-10 13:48:35

How to give a jwt token to a client?

We were given the task to make an application on a react-client and a node-back. I don’t really understand how to transfer the token to the user on the client side. I check the rest api requests through postman (such an http client), and in the headers I write:

Authorization: Bearer ejsSIaisi...-тут идет сам токен
. Okay, that's understandable. And how are these tokens written to the client in general? As I understand it, they are saved, for example, in local storage. And how to save?
How do you implement jwt authorization?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya Gerasimov, 2017-12-10
@Omashu

The user enters a login, password, sends to the server in response you give him a signed token, with some encrypted information. You can save it anywhere, in cookies, in local storage, it doesn't matter.
Now the user sends a request and passes the token (as a header, in the request, or whatever), we verify the token, get the information = we know what kind of user and other information.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question