added socialite and some hacks via vendor sideload to add social login
This commit is contained in:
+59
-2
@@ -1,4 +1,6 @@
|
||||
<?php
|
||||
use SocialNorm\Exceptions\ApplicationRejectedException;
|
||||
use SocialNorm\Exceptions\InvalidAuthorizationCodeException;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -11,10 +13,65 @@
|
||||
|
|
||||
*/
|
||||
|
||||
Auth::routes();
|
||||
|
||||
|
||||
Route::get('/', function () {
|
||||
return view('welcome');
|
||||
});
|
||||
|
||||
Auth::routes();
|
||||
|
||||
Route::get('/home', 'HomeController@index')->name('home');
|
||||
|
||||
// ----------------- SOCIAL LOGIN --------------------
|
||||
|
||||
Route::get('/auth/github/authorize', function() {
|
||||
return SocialAuth::authorize('github');
|
||||
})->name('oauth-github-authorize');
|
||||
|
||||
Route::get('/auth/github/callback', function() {
|
||||
try {
|
||||
SocialAuth::login('github');
|
||||
} catch (ApplicationRejectedException $e) {
|
||||
dd($e);
|
||||
abort(401);
|
||||
} catch (InvalidAuthorizationCodeException $e) {
|
||||
dd($e);
|
||||
abort(401);
|
||||
}
|
||||
return Redirect::intended();
|
||||
})->name('oauth-github-login');
|
||||
|
||||
|
||||
|
||||
Route::get('/auth/google/authorize', function() {
|
||||
return SocialAuth::authorize('google');
|
||||
})->name('oauth-google-authorize');
|
||||
|
||||
Route::get('/auth/google/login', function() {
|
||||
try {
|
||||
SocialAuth::login('google');
|
||||
} catch (ApplicationRejectedException $e) {
|
||||
abort(401);
|
||||
} catch (InvalidAuthorizationCodeException $e) {
|
||||
abort(401);
|
||||
}
|
||||
return Redirect::intended();
|
||||
})->name('oauth-google-login');
|
||||
|
||||
|
||||
|
||||
|
||||
Route::get('/auth/facebook/authorize', function() {
|
||||
return SocialAuth::authorize('facebook');
|
||||
})->name('oauth-facebook-authorize');
|
||||
|
||||
Route::get('/auth/facebook/login', function() {
|
||||
try {
|
||||
SocialAuth::login('facebook');
|
||||
} catch (ApplicationRejectedException $e) {
|
||||
abort(401);
|
||||
} catch (InvalidAuthorizationCodeException $e) {
|
||||
abort(401);
|
||||
}
|
||||
return Redirect::intended();
|
||||
})->name('oauth-facebook-login');
|
||||
|
||||
Reference in New Issue
Block a user