I use jwt-auth for authentication and i have two authenticatable models in my project "User" and "Company". I have to different middlewares. one for "User" and one for "Company". and each model had its own token (saved in cookies).
This two model is related (user belongs to a company)
now i want to get a user and if the user belongs to Company, login the user as company too. it simple to do this, but i need to do this with token. 令牌就可以做到这一点。 because i want to use one request and one middleware.
Is there any way or method that i can set user token to company. instead of get new token from company?
Generally speaking, this is not proper way. User
should be authenticated, and not the Company
, but user belongs to
company, so you can modify/access/change data, within that relationship.
IMO, you should go that path.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.