Laravel 护照:Lcobucci\JWT\Token\InvalidTokenStructure 值不符合允许的日期格式
Laravel passport: Lcobucci\JWT\Token\InvalidTokenStructure Value is not in the allowed date format
我创建了一个 laravel 通行证来通过 api 验证应用程序。该设置在我的机器上运行良好,但是当我将项目移动到服务器时,我总是会收到以下错误:
“Lcobucci\JWT\Token\InvalidTokenStructure
值不符合允许的日期格式:1616443683.7318161"
用户已创建且注册在以下行中引发错误 500:
$success['token'] = $user->createToken('appToken')->accessToken;
注册函数
public function register(Request $request)
{
$validator = Validator::make($request->all(), [
'firstname' => 'required',
'lastname' => 'required',
'phone' => 'digits_between:4,30|numeric',
'email' => 'required|email|unique:users',
'password' => 'required',
]);
if ($validator->fails()) {
return response()->json([
'success' => false,
'message' => $validator->errors(),
], 401);
}
$input = $request->all();
$input['password'] = bcrypt($input['password']);
$user = User::create($input);
$success['token'] = $user->createToken('appToken')->accessToken;
return response()->json([
'success' => true,
'token' => $success,
'user' => $user
]);
}
将 Lcobucci\JWT 从最新版本降级到 v3.4
我创建了一个 laravel 通行证来通过 api 验证应用程序。该设置在我的机器上运行良好,但是当我将项目移动到服务器时,我总是会收到以下错误: “Lcobucci\JWT\Token\InvalidTokenStructure 值不符合允许的日期格式:1616443683.7318161"
用户已创建且注册在以下行中引发错误 500:
$success['token'] = $user->createToken('appToken')->accessToken;
注册函数
public function register(Request $request)
{
$validator = Validator::make($request->all(), [
'firstname' => 'required',
'lastname' => 'required',
'phone' => 'digits_between:4,30|numeric',
'email' => 'required|email|unique:users',
'password' => 'required',
]);
if ($validator->fails()) {
return response()->json([
'success' => false,
'message' => $validator->errors(),
], 401);
}
$input = $request->all();
$input['password'] = bcrypt($input['password']);
$user = User::create($input);
$success['token'] = $user->createToken('appToken')->accessToken;
return response()->json([
'success' => true,
'token' => $success,
'user' => $user
]);
}
将 Lcobucci\JWT 从最新版本降级到 v3.4