I have been facing the same problem and search in Laravel Passport's issue: Passport doesn't redirect back to authorization form after login. I saw that issue #248 and #703 get this problem too. But, I don't find the answer to solve this problem.
Suddenly, I remember that I have been implement GitHub OAuth2 with Laravel Socialite and I think the flow is same because it using Authorization code flow grant type.
First, I inspect network, check url address bar for GitHub OAuth2 flow with Laravel Socialite.
Second, I analyze what's going on and find out that route oauth/authorize
bind by auth
middleware after run php artisan route:list
. So, I just modify the Authenticate middleware, login controller, and login view. I run php artisan make:auth
to generate auth scaffolding.
Third, I just play around with dd()
to get result of $request
(Laravel Request API).
Modified files attached below.
Hope it helps!
This worked for me with Laravel Breeze (switching from Sanctum to Passport)
laravel/passport#248 (comment)