#5: Added Laravel Socialite. The redirect to Facebook is now working.
This commit is contained in:
parent
eaba161f5c
commit
564fcd4b09
@ -6,6 +6,7 @@ use App\Facade\Theme;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Foundation\Auth\AuthenticatesUsers;
|
||||
use Illuminate\Http\Request;
|
||||
use Socialite;
|
||||
|
||||
class LoginController extends Controller
|
||||
{
|
||||
@ -61,4 +62,27 @@ class LoginController extends Controller
|
||||
'info' => $request->session()->get('info')
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect the user to the Facebook authentication page.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function redirectToFacebook()
|
||||
{
|
||||
return Socialite::driver('facebook')->redirect();
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain the user information from Facebook.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function handleFacebookCallback()
|
||||
{
|
||||
$user = Socialite::driver('facebook')->user();
|
||||
dd($user);
|
||||
|
||||
// $user->token;
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,8 @@
|
||||
"laravel/framework": "5.5.*",
|
||||
"rackspace/php-opencloud": "^1.16",
|
||||
"doctrine/dbal": "^2.5",
|
||||
"aws/aws-sdk-php": "^3.19"
|
||||
"aws/aws-sdk-php": "^3.19",
|
||||
"laravel/socialite": "^3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"filp/whoops": "~2.0",
|
||||
|
127
composer.lock
generated
127
composer.lock
generated
@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "2469338aa47d9194dc0c44bc788fb070",
|
||||
"content-hash": "7e1113109ae57d549a01afba28bdb219",
|
||||
"packages": [
|
||||
{
|
||||
"name": "aws/aws-sdk-php",
|
||||
@ -948,6 +948,68 @@
|
||||
],
|
||||
"time": "2018-03-30T13:29:30+00:00"
|
||||
},
|
||||
{
|
||||
"name": "laravel/socialite",
|
||||
"version": "v3.0.12",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/laravel/socialite.git",
|
||||
"reference": "b5f465847b1d637efa86bbfe2fc1c9d2bd12f60f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/laravel/socialite/zipball/b5f465847b1d637efa86bbfe2fc1c9d2bd12f60f",
|
||||
"reference": "b5f465847b1d637efa86bbfe2fc1c9d2bd12f60f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"guzzlehttp/guzzle": "~6.0",
|
||||
"illuminate/contracts": "~5.4",
|
||||
"illuminate/http": "~5.4",
|
||||
"illuminate/support": "~5.4",
|
||||
"league/oauth1-client": "~1.0",
|
||||
"php": ">=5.4.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"mockery/mockery": "~0.9",
|
||||
"phpunit/phpunit": "~4.0|~5.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.0-dev"
|
||||
},
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Laravel\\Socialite\\SocialiteServiceProvider"
|
||||
],
|
||||
"aliases": {
|
||||
"Socialite": "Laravel\\Socialite\\Facades\\Socialite"
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Laravel\\Socialite\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Taylor Otwell",
|
||||
"email": "taylor@laravel.com"
|
||||
}
|
||||
],
|
||||
"description": "Laravel wrapper around OAuth 1 & OAuth 2 libraries.",
|
||||
"keywords": [
|
||||
"laravel",
|
||||
"oauth"
|
||||
],
|
||||
"time": "2018-06-01T15:06:47+00:00"
|
||||
},
|
||||
{
|
||||
"name": "league/flysystem",
|
||||
"version": "1.0.45",
|
||||
@ -1032,6 +1094,69 @@
|
||||
],
|
||||
"time": "2018-05-07T08:44:23+00:00"
|
||||
},
|
||||
{
|
||||
"name": "league/oauth1-client",
|
||||
"version": "1.7.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/thephpleague/oauth1-client.git",
|
||||
"reference": "fca5f160650cb74d23fc11aa570dd61f86dcf647"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/thephpleague/oauth1-client/zipball/fca5f160650cb74d23fc11aa570dd61f86dcf647",
|
||||
"reference": "fca5f160650cb74d23fc11aa570dd61f86dcf647",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"guzzlehttp/guzzle": "^6.0",
|
||||
"php": ">=5.5.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"mockery/mockery": "^0.9",
|
||||
"phpunit/phpunit": "^4.0",
|
||||
"squizlabs/php_codesniffer": "^2.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"League\\OAuth1\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Ben Corlett",
|
||||
"email": "bencorlett@me.com",
|
||||
"homepage": "http://www.webcomm.com.au",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "OAuth 1.0 Client Library",
|
||||
"keywords": [
|
||||
"Authentication",
|
||||
"SSO",
|
||||
"authorization",
|
||||
"bitbucket",
|
||||
"identity",
|
||||
"idp",
|
||||
"oauth",
|
||||
"oauth1",
|
||||
"single sign on",
|
||||
"trello",
|
||||
"tumblr",
|
||||
"twitter"
|
||||
],
|
||||
"time": "2016-08-17T00:36:58+00:00"
|
||||
},
|
||||
{
|
||||
"name": "mikemccabe/json-patch-php",
|
||||
"version": "0.1.0",
|
||||
|
@ -14,6 +14,12 @@ return [
|
||||
|
|
||||
*/
|
||||
|
||||
'facebook' => [
|
||||
'client_id' => env('FACEBOOK_CLIENT_ID'),
|
||||
'client_secret' => env('FACEBOOK_CLIENT_SECRET'),
|
||||
'redirect' => url('login/facebook/callback')
|
||||
],
|
||||
|
||||
'gitea' => [
|
||||
'api_url' => 'https://apps.andysh.uk/api/v1',
|
||||
'cache_time_seconds' => 3600,
|
||||
|
@ -74,6 +74,10 @@ Route::group(['prefix' => 'install'], function () {
|
||||
Route::post('/database', 'InstallController@database')->name('install.database');
|
||||
});
|
||||
|
||||
// Social media SSO
|
||||
Route::get('login/facebook', 'Auth\LoginController@redirectToFacebook')->name('login.facebook');
|
||||
Route::get('login/facebook/callback', 'Auth\LoginController@handleFacebookCallback')->name('login_callback.facebook');
|
||||
|
||||
// Gallery
|
||||
Route::get('/', 'Gallery\DefaultController@index')->name('home');
|
||||
Route::get('/activate/{token}', 'Auth\ActivateController@activate')->name('auth.activate');
|
||||
|
Loading…
Reference in New Issue
Block a user