Answer the question
In order to leave comments, you need to log in
Single Authorization JWT?
Hello! There are 2 sites, one on a domain, the second on a subdomain. Is it possible to do Single Authorization using JWT in PHP?
So that they are authorized on one, went to the second and immediately in the login. If two are out, then two are relogin. Synchronization comes to mind here. But how and where to dig?
Answer the question
In order to leave comments, you need to log in
You have a somewhat strange idea of how jwt works,
but your goal is simple, there should be a separate authentication service that generates a token, issues it and manages it in the future. This service can be located both on the main domain and on a separate subdomain ala auth.domain.com
to understand whether the user is logged in or not and whether his token is valid (whether it has expired) we look at this data in the token payload https://jwt .io/ (this is a simple operation that even a js client application can perform)
ps but in order to log out, you need to study the jwt topic better, since you can’t explain it on your fingers if you are not in the subject) just a little hint: so as this is somewhat contrary to the stateless approach of tokens, you will need 2 tokens
update: about simultaneous subdomain login, you need to tweak a bit
https://stackoverflow.com/questions/4026479/use-lo...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question