I tried to implement oath2 with my application. I followed the steps and I created a route:
Route::post('/login', [AuthenticatedSessionController::class, 'store'])->middleware('guest') ->name('login');
The action:
public function store(LoginRequest $request): JsonResponse
{
$request->authenticate();
/** @var User $user */
$user = Auth::user();
$token = $user->createToken($user->name);
return response()->json($user->toArray());
}
When I try to use the createToken method the API tells me this: Client authentication failed
After some digging I realised that this method is the problem:
Description:
I tried to implement oath2 with my application. I followed the steps and I created a route:
Route::post('/login', [AuthenticatedSessionController::class, 'store'])->middleware('guest') ->name('login');
The action:
When I try to use the createToken method the API tells me this: Client authentication failed
After some digging I realised that this method is the problem:
The $secret is always null when the Passport::hashClientSecrets(); is inside my AuthServiceProvider::boot method.
Steps To Reproduce:
Update: If I try to do a normal /oauth/token request it works. The createToken method still is a problem.