Hi, have you solve the issue just yet? I'm currently stumble on the some problem
Aug 5, 2017
3
Level 1
"Call to a member function forceFill() on null" Error when calling $user->createToken('Token')->accessToken
Hi
I use passport for api registration/login when I call
here is my login code from a tutorial:
public function login(){
if(Auth::attempt(['email' => request('email'), 'password' => request('password')])){
$user = Auth::user();
$success['token'] = $user->createToken('Token')->accessToken;
return response()->json(['success' => $success], $this->successStatus);
}
else{
return response()->json(['error'=>'Unauthorised'], 401);
}
}
by calling this method I get error: Call to a member function forceFill() on null
=>
in PersonalAccessTokenFactory.php (line 75)
at PersonalAccessTokenFactory->Laravel\Passport\{closure}(null)
in helpers.php (line 950)
at tap(null, object(Closure))
in PersonalAccessTokenFactory.php (line 79)
at PersonalAccessTokenFactory->make('5984bc9a6ed0d80c08001fc4', 'Token', array())
in HasApiTokens.php (line 67)
at User->createToken('Token')
in UserController.php (line 26)
Please or to participate in this conversation.