i'm trying to forget some session key's and then redirect the user (redirect() doesn't work so I use header()) to an external website.
I have noticed however that these session keys are persisting.
class CognitoUserProvider
{
/**
* @return void
*/
private function sendToLoginPage(): void
{
request()->session()->forget([ 'access_token', 'id_token', 'refresh_token' ]);
$query = http_build_query([
'client_id' => $this->clientId,
'response_type' => 'code',
'redirect_uri' => 'https://localhost/'
]);
session([ 'redirect_url' => URL::current() ]);
header("Location: https://{$this->domain}/login?$query&scope=email+openid");
exit;
}
// AuthServiceProvider.php
public function boot()
{
$this->registerPolicies();
Auth::extend('cognito', static function () {
return new CognitoUserProvider();
});
}
Any ideas?