jwt auth_什么是JSON Web令牌? JWT Auth教程

JWT是一种用于在客户端和服务器之间安全传输信息的标准,以JSON对象形式实现紧凑和独立的认证方式。在用户登录后,应用生成JWT并返回给用户,用于后续请求的授权,常用于单一登录方案。Thomas Weibenfalk的教程详细解释了JWT的使用。
摘要由CSDN通过智能技术生成

jwt auth

Most web apps use security measures to make sure user data stays private. Authentication is a key part of security and JSON Web Tokens (JWT) are a great way to implement authentication.

大多数Web应用程序都使用安全措施来确保用户数据保持私密性。 身份验证是安全性的关键部分,JSON Web令牌(JWT)是实现身份验证的好方法。

那么什么是JSON Web令牌? (So what are JSON Web Tokens?)

JWT is a standard that defines a compact and self-contained way to securely transmit information between a client and a server as a JSON object. The compact size makes the tokens easy to transfer through an URL, POST parameter, or inside an HTTP header. Also, since they are self-contained they include all the necessary information about a user so the database does not need to be queried more than once.

JWT是一种标准,它定义了一种紧凑且独立的方法,以在客户端和服务器之间安全地将信息作为JSON对象传输。 紧凑的大小使令牌易于通过URL,POST参数或HTTP头内部进行传输。 而且,由于它们是独立的,因此它们包含有关用户的所有必要信息,因此无需多次查询数据库。

The information in a JWT can be trusted because it is digitally signed using a secret or public/private key pair.

JWT中的信息是可信任的,因为它是使用秘密或公用/专用密钥对进行数字签名的。

认证方式 (Authentication)

JWT are mainly used for authentication. After a user logs in to an application, the application will create a JWT and send it back to the user. Subsequent requests by the user will include the JWT. The token tells the server what routes, services, and resources the user is allowed to access. JWT can be easily used across multiple domains so they are often used for Single Sign On.

JWT主要用于身份验证。 用户登录到应用程序后,该应用程序将创建一个JWT并将其发送回用户。 用户的后续请求将包括JWT。 令牌告诉服务器允许用户访问哪些路由,服务和资源。 JWT可以轻松地在多个域中使用,因此它们通常用于单一登录。

使用JSON Web令牌 (Using JSON Web Tokens)

Thomas Weibenfalk made an excellent video tutorial that explains JSON Web Tokens and demonstrates how to use them for authentication. The tutorial teaches JWT Auth as simply as possible, without using a lot of extra libraries.

Thomas Weibenfalk制作了出色的视频教程,解释了JSON Web令牌并演示了如何使用它们进行身份验证。 本教程尽可能简单地讲授JWT Auth,而无需使用很多额外的库。

Watch the tutorial below or on the freeCodeCamp.org YouTube channel (2 hour watch).

观看下面的教程或在freeCodeCamp.org YouTube频道上 (观看2小时)。

翻译自: https://www.freecodecamp.org/news/what-are-json-web-tokens-jwt-auth-tutorial/

jwt auth

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值