API user authentication method based on JWT authentication

A user authentication and user technology, applied in the field of API verification, can solve the problem that the authentication method is not suitable for long-term identity authentication and short-term resources, routing authentication, cannot cross applications and single sign-on, and is not suitable for distributed applications and multi-terminal applications. , to achieve the effect of satisfying flexibility and improving safety

Inactive Publication Date: 2019-03-08
弘成科技发展有限公司
View PDF2 Cites 14 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0004] The purpose of the present invention is to provide an API user authentication method based on JWT verification, which solves the problem that the current authentication method is not suitable for long-term identity authentication and short-term resource and routing authentication, is not suitable for distributed applications and multi-terminal applications, and cannot span applications and single points login problem

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0018] In order to make the object, technical solution and advantages of the present invention more clear, the present invention will be further described in detail below in conjunction with the examples. It should be understood that the specific embodiments described here are only used to explain the present invention, not to limit the present invention.

[0019] For the embodiment of the present invention, a kind of API user authentication method based on JWT verification, comprises the following steps:

[0020] When the user logs in, the user is first authenticated, and after the user is authenticated, the token is obtained and returned to the client. The client receives the token and saves it, and brings the token value with it when requesting data next time.

[0021] Create an interceptor middleware. The middleware needs to verify the correctness of the token. After the verification is passed, it will jump to the requested page. After the request is completed, the token ...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

The invention discloses an API user authentication method based on JWT authentication. The API user authentication method based on the JWT authentication comprises the following steps: S1, authenticating a user when the user logs in, obtaining a token and returning to a client after authenticating that the user passes; S2, creating interceptor middleware and authenticating the correctness of the token; and S3, adding the interceptor middleware to different routes according to service requirements. The invention uses the JWT authentication in the user login process, which effectively prevents client forging cookie information, therefore, the security of a project is improved; at the same time, the JWT authentication is used in a data interface, and the token expiration time can be configured according to a related service, thus, data security is improved and service flexibility is satisfied.

Description

technical field [0001] The invention relates to the technical field of API verification, in particular to an API user authentication method based on JWT verification. Background technique [0002] The existence of Cookie+Session is mainly to solve the problem of how the server identifies the user under HTTP, a stateless protocol. The server retains the corresponding Session (file or DB). The subsequent requests initiated by the user will carry cookie information, and the server needs to retrieve the corresponding Session based on the cookie, so as to complete the verification and confirm that this is the user who has logged in before. [0003] The current API authentication method has the following disadvantages: it is not suitable for long-term identity authentication and short-term resource and routing authentication; it is not suitable for distributed applications and multi-terminal applications; it cannot cross applications and single sign-on. Contents of the inventio...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
Patent Type & Authority Applications(China)
IPC IPC(8): H04L29/06H04L9/32
CPCH04L9/3213H04L63/0807H04L63/0815
Inventor 刘进雪
Owner 弘成科技发展有限公司
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products