My user on request is for some reason null.
public function handle($request, $next, ...$scopes)
{
dd($request->user());
}
I recieve [null even though I have all the credentials there and valid][1] [My kernel.php][2]
[My guards in auth.php][3]
[My middleware now updated][4]
So moving from my previous problem now I am getting
{ "message": "Unauthenticated." } [1]: https://i.stack.imgur.com/efdax.png [2]: https://i.stack.imgur.com/L1lUI.png [3]: https://i.stack.imgur.com/TulwQ.png [4]: https://i.stack.imgur.com/F1AEE.png
CodePudding user response:
I noticed from your latest comment there, did you mean singular scope:view-products
and not plural scopes
?
Also, I've shared below laravel 9.x documentation link.
And I'd suggest retracing your steps, from Step 1 to current of setting up Laravel Passport. I reckon one or two steps are missed - like the guard setup, or scope setup. Or best guess about typo mentioned above.
Hope this helps.
Source: https://laravel.com/docs/9.x/passport#check-for-any-scopes
CodePudding user response:
My bad everything works I was supposed to use different tipe of scoping https://laravel.com/docs/9.x/passport#client-credentials-grant-tokens Example: Route::middleware(['client:view-products', 'client.auth'])->group(function () {}