【发布时间】:2016-04-11 13:13:38
【问题描述】:
我已经看到 in many placestoken-based authentication 优于 cookie-based authentication 的好处之一是它更适合 CORS/跨域场景。
但是为什么呢?
这里是a CORS scenario:
从http://domain-a.com 提供的HTML 页面生成
<img>src 请求http://domain-b.com/image.jpg。
即使我的机器上有一个令牌,仅仅<img> 标签怎么会知道在哪里找到并发送它?
根据here,建议将JWT存储为cookie,那么如何在CORS/跨域场景下生存?
添加 1 个
基于令牌的身份验证比会话cookie 更容易扩展。在此处查看相关主题:Stateless web application, an urban legend?
【问题讨论】:
标签: authentication cookies cors token jwt