Our task is introduced

This blog is a complete tutorial document for my Github project Our-Task: A complete list management system. If you are interested, you can check it out

Analysis of the

In our-Task, after the user logs in successfully, the user’s token is generated and returned. When the user invokes another interface, the user carries the token in the headers to invoke the request, and the invocation succeeds. In our-Task, tokens are placed in the header Authorization.

The solution

Access token

The login interface is open and does not require any permission. After a successful login, the user’s token will be obtained. In the Authorization of headers, the token will be generated after a successful login.

Test calls to other methods

Now let’s use the token to call another method. We call the interface, click headers, and configure the request header

In the request header, we pass in the Authorization we just obtained and the corresponding value. Then you can make the interface call as usual.

This is the interface to query the information of a single user, which shows that we have successfully called.

Matters needing attention

  1. Tokens have an expiration date. If you find that you are not allowed to fill in a token, you may want to check whether your token is the latest one
  2. For the sake of development efficiency, you can turn off SpringSecurity interception so that you don’t have to fill headers for testing yourself