Skip to content

Commit

Permalink
Catch GitHub OAuth errors; log and show toast
Browse files Browse the repository at this point in the history
Co-Authored-By: Marcy Acevedo <[email protected]>
  • Loading branch information
mattstauffer and MarcyLina committed Jun 3, 2024
1 parent 15d87a5 commit 15446f2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app/Http/Controllers/Auth/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Log;
use Illuminate\View\View;
use Laravel\Socialite\Facades\Socialite;

Expand Down Expand Up @@ -76,6 +77,13 @@ public function handleProviderCallback()

return $userExists ? redirect(route_wlocale('modules.index')) : redirect()->intended();
} catch (Exception $e) {
if (request()->has('code') && request()->has('state')) {
Log::error($e);

session()->flash('toast-title', 'GitHub Error');
session()->flash('toast', 'There was an error authenticating with GitHub.');
}

return redirect(route_wlocale('login'));
}
}
Expand Down

0 comments on commit 15446f2

Please sign in to comment.