N
N
nepster-web2017-02-10 15:08:30
PHP
nepster-web, 2017-02-10 15:08:30

How to generate a unique key for JWT if it is not recommended to store it in the database?

I use this library: https://github.com/firebase/php-jwt
As you can see, in order to encrypt / decrypt the token, a secret key is needed.
If I want to generate my own unique key for security for each token, then how can I find out from whom, which key if I do not store the tokens in the database?
How does anyone approach this issue?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
kulaeff, 2017-02-10
@nepster-web

Hmm, JWT is already invented for security. And what does it mean for each token to generate a unique key? The secret key is needed to sign the tokens. Only the server knows the secret key. The server generated and signed the token, gave it to the front, then the front made a request, sending the token along with the request, and the server, knowing the secret key, decodes this token and identifies the user without accessing the database.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question