Token problem of vue-cli front-end separation project

use vue-cli for front and back end separate development. For example, the front end performs login operation, and the back end returns token:

.
return response()->json([
            "access_token" => $tokenResult->accessToken,
            "token_type" => "Bearer",
            "expires_at" => Carbon::parse(
                $tokenResult->token->expires_at
            )->toDateTimeString()
        ]);


question:
1. After the frontend gets the token returned by the backend, do you need to bring the token with you every time you initiate a request?
2. Because token is about to expire, does every method in the backend return token??

May.29,2021

  1. if the backend uses this to check the expiration time, it is the
  2. that needs to be brought. It is true that the
  3. token will expire, but after each request, the backend should reset the validity of the token to the maximum. You don't need to return token every time. The new token, is returned only when it expires. At this time, the front end needs to update the token
  4. .

  1. is
  2. No, the front end always has the original token , wait for the backend to inform you that it expires, then renew through refresh_token , or re-jump to log in.

the project on my side is that after login, each request will bring the token returned by login. After the
token expires, the specified status code is returned, forcing the jump login.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b2b77d-2b2ed.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b2b77d-2b2ed.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?