W
W
WarriorKodeK2018-05-30 18:40:27
User identification
WarriorKodeK, 2018-05-30 18:40:27

How to do 2 factor authentication?

Hello. The project required 2 factor authorization.
How does this happen (meaning the interaction of the front and the back)?
That is, according to my logic: The
user enters a password and the login presses the confirm button, this data is sent to the back, some key is generated on the back and sent to the user to the specified mail, he inserts this key into the input, presses confirm, this key is sent to the back and checks with the fact that it was generated, if everything is fine, we let the user into the app.
If you have any articles or examples, please post them.
Technology stack:

  • Frontend: React & Redux
  • Back-end: PHP

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Avrong, 2018-05-30
@WarriorKodeK

The user enters a password and the login presses the confirm button, this data is sent to the back

The simplest form and handler.
Function for random key generation. For example, like this , but it's better to write your own.
The generated key must be placed in some type of database storage (and set the parameters for the expiration of the code, the owner of the code, the number of attempts to enter) and verify when the user enters.
Again the form and handler.

L
l1l1l1, 2018-05-31
@l1l1l1

Better use 2FA from Google: https://www.google.ru/landing/2step/
Mail can be hacked (most users have the same passwords, even if you generate a password, many change it to the usual one), and in the case of 2FA from Google this option is excluded.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question