[英]Implementation JWT on Application (Understanding concept of JWT)
我刚刚在 PHP 上学习了 JWT。 我有点了解 JWT 如何在单页上工作。 当我在多个页面(页面到另一个页面)上实现时。
如果每个用户移动到另一个页面,我们必须用令牌(承载代码)填充 HTTP_AUTHORIZATION 并同时生成新令牌,我的实现是否正确?
提前致谢
从概念上讲,JWT 是使用用户名和密码成功登录后发给用户的不记名令牌。
Normally for mobile app we set long expiry for a JWT token, while for a web app, we use the JWT refresh mechanism to avoid invalid API abuse by invalidating the old token and refresh with a new set of token without login again. 一旦 JWT 令牌过期,则需要将用户踢出。
对于移动应用程序,JWT 可以保存在 SharedPreference 中,并为所有 API 调用使用相同的密钥。 将其设置为环境而不是基于页面,这样您就无需每次在每个页面中重新设置它。
阅读此https://tech.justeattakeaway.com/2019/12/04/lessons-learned-from-handling-jwt-on-mobile/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.