B
B
BMaks_N12019-02-26 00:36:59
JavaScript
BMaks_N1, 2019-02-26 00:36:59

How to arrange authorization in a React application?

There is a single-page application, on React, there are pages available only to authorized users, firstly, how to pull a login-password from the authorization page, transfer it through props?
Or in somewhere separately to store the data? what do you advise?)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Okhotnikov, 2019-02-26
@tsepen

The password cannot be stored on the client, during authorization you send a login and password - in response you receive a token, save it to cookies, for example, now with each request a token will be sent to the server and if it is valid, the user will be returned.

A
Alexander Alekseev, 2019-02-26
@shure348

give private content only for requests with a token,
read about JWT
Passport to help you

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question