duanhe3393 2019-05-11 15:51
浏览 139
已采纳

在jwt-auth中可以使用一个令牌用于两个模型吗?

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 just one 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?

  • 写回答

1条回答 默认 最新

  • dongshan2680 2019-05-11 21:29
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改
  • ¥20 wireshark抓不到vlan
  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持
  • ¥15 stata安慰剂检验作图但是真实值不出现在图上
  • ¥15 c程序不知道为什么得不到结果
  • ¥15 键盘指令混乱情况下的启动盘系统重装
  • ¥40 复杂的限制性的商函数处理