S
S
Stanislav2020-10-04 03:25:57
PHP
Stanislav, 2020-10-04 03:25:57

Authorization by JWT. How to organize?

Hello.

There is a PHP project to which JWT authorization needs to be attached. How to organize the logic of work?

We receive an encrypted JWT with user data, what should we do next? There is no way to put it in the browser's localstorage, since this is PHP. Add to session? The same is not an option, since the API server and the frontend server may have different domains and the session will not work in this case.

I would like to know the opinion of more experienced people who have encountered or solved similar issues, what are the methods of authorization by JWT? Or, how to store the Json Web Token with the user and, if necessary, receive it on the API server and authenticate the user?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Shumov, 2020-10-04
@inoise

There are many ways. From cache storage to database storage. In any case, the token is a temporary thing and eventually it will go rotten anyway.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question