vicalloy
V2EX  ›  问与答

大家的 React 和 Vue 是不是都配合 JWT 做登录管理

  •  
  •   vicalloy · May 15, 2020 · 1353 views
    This topic created in 2218 days ago, the information mentioned may be changed or developed.
    按我的理解 JWT 的优点和缺点都很明显。
    优点:JWT 不需要服务端保存认证信息,可以很方便的实现多应用的统一认证。
    缺点:JWT 的 token 一旦颁发出去,就无法失效(比如用户修改密码后,要把之前登录的设备全部 T 下线)。如果需要单独对某个 token 做失效处理就必须在服务端对 token 做二次校验,相比 session 的优势就没多少优势了。
    2 replies    2020-05-16 09:10:41 +08:00
    TabGre
        1
    TabGre  
       May 15, 2020
    这个跟用什么前端框架没有什么关系吧 :dog:
    hackingwu
        2
    hackingwu  
       May 16, 2020
    优势还是很明显的呀,无状态,方便水平拓展呀。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1323 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 38ms · UTC 17:22 · PVG 01:22 · LAX 10:22 · JFK 13:22
    ♥ Do have faith in what you're doing.