File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
app/Http/Controllers/Auth Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 6
6
use App \Jobs \UpdateProfile ;
7
7
use App \Models \User ;
8
8
use App \Social \GitHubUser ;
9
+ use GuzzleHttp \Exception \ClientException ;
10
+ use GuzzleHttp \Exception \ServerException ;
9
11
use Illuminate \Database \Eloquent \ModelNotFoundException ;
10
12
use Illuminate \Http \RedirectResponse ;
11
13
use Illuminate \Support \Facades \Auth ;
@@ -47,7 +49,13 @@ public function handleProviderCallback()
47
49
48
50
private function getSocialiteUser (): SocialiteUser
49
51
{
50
- return Socialite::driver ('github ' )->user ();
52
+ try {
53
+ return Socialite::driver ('github ' )->user ();
54
+ } catch (ClientException |ServerException $ e ) {
55
+ $ this ->error ('An error occurred while trying to log in with GitHub. Please try again. ' );
56
+
57
+ return redirect ()->route ('login ' );
58
+ }
51
59
}
52
60
53
61
private function userFound (User $ user , SocialiteUser $ socialiteUser ): RedirectResponse
You can’t perform that action at this time.
0 commit comments