Skip to content

Commit

Permalink
#59 - return user back home after failed oAuth request
Browse files Browse the repository at this point in the history
  • Loading branch information
Gummibeer committed Apr 19, 2021
1 parent defaf22 commit fe8b02e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/Http/Controllers/Auth/GithubController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,23 @@
use App\Jobs\SyncUserOrganizations;
use App\Jobs\UpdateUserDetails;
use App\Models\User;
use Illuminate\Auth\Events\Registered;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Bus;
use Laravel\Socialite\Two\GithubProvider;
use Laravel\Socialite\Facades\Socialite;
use Laravel\Socialite\Two\InvalidStateException;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;

class GithubController
{
public function __invoke(): Response
{
$githubUser = $this->socialite()->user();
try {
$githubUser = $this->socialite()->user();
} catch (InvalidStateException $ex) {
return redirect()->route('home');
}

$data = [
'email' => $githubUser->getEmail(),
Expand Down

0 comments on commit fe8b02e

Please sign in to comment.