hello , in Laravel , with Passport . we have a Autorization Method ( /outh/authorize ).
A service (a Laravel Project 2 ) sends a authorization to other project ( Laravel Project 1 ) .
like this -
https://laravel.com/docs/11.x/passport#when-requesting-authorization-codes
with this code -
Route::get('/redirect', function () {
$query = http_build_query([
'client_id' => 'client-id',
'redirect_uri' => 'http://example.com/callback',
'response_type' => 'code',
'scope' => 'place-orders check-status',
]);
return redirect('http://passport-app.test/oauth/authorize?'.$query);
( Laravel project 2 sending to Laravel project 1 a Authorization Code );
my question is , the project that receives the authorization code (oauth/authorize ), it uses SESSION to check if -
- user is logged in , returns the authorization code .
- if is not logged in , returns and logg in , after logg in . turn back and send authorization code .
I wold like to do this withoute use session , having VUE js at front and laravel in Backend .
the way it is , it needs to use session , and it cant separate front and backed .
to do that I will need to overite this method -
public function approve(Request $request)
{
$this->assertValidAuthToken($request);
$authRequest = $this->getAuthRequestFromSession($request);
$authRequest->setAuthorizationApproved(true);
return $this->withErrorHandling(function () use ($authRequest) {
return $this->convertResponse(
$this->server->completeAuthorizationRequest($authRequest, new Psr7Response)
);
});
}
wold be a good idea to do that ?