A
A
Analka2021-02-23 11:46:47
Laravel
Analka, 2021-02-23 11:46:47

How to properly store Laravel api temporary value on server?

Good afternoon, there is a client on vue and api on Larave

how to properly store a temporary random code in apiha, which is sent by SMS to the client's number through the Twillio service.

The scheme is as follows:
1. The client enters a phone number and presses send
2. A request is sent to api
3. A random number is generated and sent by SMS - and at this moment this number needs to be somehow saved for the current user
4. The client receives an SMS and he enters the code in the field and presses check
5. The request with the code goes to api and here you need to check it

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
Zlatoslav Desyatnikov, 2021-03-04
@pxz

Write to the cache, where in the key use the phone number (only numbers) and some kind of prefix.
The cache entry has a lifetime, you can just use it to limit the code entry time.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question