The login

The POST request /user/login returns only a token, which lasts for 30 minutes

{"code": "0", "MSG ":" login successful ", "data": {"token": Mqf6ok2uoomdv "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9. EyJzdWIiOiIxMyxUUUwiLCJpYXQiOjE2MDIwNjk0MjIsImV4cCI6MTYwMjA3MTIyMn0. 6 9bfztbTW3vI40CPTzMB724MmglBznnQ0Yi87dhGXpG8t3QQ_pulza3Bg3YzmbYxyvixnNcKA" } }Copy the code

The refresh token

POST request, the original GET request needs to be changed. /user/refreshToken After the token is invalid, the code returned by refreshToken is 401. The request is initiated using the old token, which is in the header. You can refresh the token using the old token within 7 days without additional parameter transmission. After 7 days, the interface request fails and the 401 HTTP status code is reported

{"code": "0", "MSG ":" success ", "data": {"token": Mqf6ok2uoomdv "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9. EyJzdWIiOiIxMyxUUUwiLCJpYXQiOjE2MDIwNjk0MjIsImV4cCI6MTYwMjA3MTIyMn0. 6 9bfztbTW3vI40CPTzMB724MmglBznnQ0Yi87dhGXpG8t3QQ_pulza3Bg3YzmbYxyvixnNcKA" } }Copy the code

Note: Return code: 401 after the token expires 30 minutes after the request is initiated. In this case, an error message is displayed on the interface for refreshing the token. The HTTP status code is 401