I upgraded to Laravel Passport v11 and now when I request authorization I no longer get redirected back to the authorize form after login. This is my code below:
$query = http_build_query([
'client_id' => '6',
'redirect_uri' => 'http://localhost/oauth2_client/callback.php',
'response_type' => 'code',
'scope' => '',
]);
header('Location: http://127.0.0.1:8000/recruiter/oauth/authorize?'.$query);
In version 10 all of this was working. After successful login it should present the authorize form. Scoured the docs and GitHub but not much to go off.
I managed to resolve by ensuring I added the relevant guard inside passport.config
file.
Also if you move the passport routes to routes/web.php
file then remember to add the oauth/token
route to your VerifyCSRFToken
middlewares $except
array. This one threw me as it will return null otherwise. The Laravel passport documentation is lacking this information.