使用vue-cli进行前后端分离开发,比如现在前端进行登录操作,后端返回了token:
return response()->json([
'access_token' => $tokenResult->accessToken,
'token_type' => 'Bearer',
'expires_at' => Carbon::parse(
$tokenResult->token->expires_at
)->toDateTimeString()
]);
问题:
1、前端拿到后端返回的token后,每次发起请求都要带上token吗?
2、因为token要过期,所以是不是后端每个方法都要返回token?