{"id":1044,"date":"2016-11-25T03:22:54","date_gmt":"2016-11-25T03:22:54","guid":{"rendered":"http:\/\/myprojects.advchaweb.com\/?p=1044"},"modified":"2016-11-26T09:52:16","modified_gmt":"2016-11-26T09:52:16","slug":"laravel-socialite","status":"publish","type":"post","link":"https:\/\/myprojects.advchaweb.com\/index.php\/2016\/11\/25\/laravel-socialite\/","title":{"rendered":"Laravel Socialite"},"content":{"rendered":"<p>Source: <a href=\"https:\/\/github.com\/laravel\/socialite\">https:\/\/github.com\/laravel\/socialite<\/a><\/p>\n<p>I want to practice &#8216;socialite&#8217; app given by <a href=\"https:\/\/laravel.com\/docs\/5.3\/\">Laravel 5.3 documentation<\/a>. Installation:<\/p>\n<ol>\n<li>Open hosts file and Add a new domain &#8216;socialite.app&#8217; at the file\n<pre class=\"lang:default decode:true \">teddy@teddy-K43SJ:~\/Homestead$ sudo gedit \/etc\/hosts<\/pre>\n<p>Add this line in the file:<\/p>\n<pre class=\"lang:default decode:true\">192.168.10.10  socialite.app<\/pre>\n<\/li>\n<li>Edit &#8216;Homestead.yaml&#8217; file in ~\/.homestead\/ to add the new domain &#8216;socialite.app&#8217; and set the mapping\n<pre class=\"lang:default decode:true \">...\r\nsites:\r\n    ...\r\n    - map: socialite.app\r\n      to: \/home\/vagrant\/Code\/socialite\/public\r\n...<\/pre>\n<\/li>\n<li>Start vagrant with &#8216;vagrant up&#8217; or if it already started up, refresh it with &#8216;vagrant provision&#8217; then go into the ssh with &#8216;vagrant ssh&#8217;<\/li>\n<li>Go into &#8216;Code&#8217; directory then create a new laravel project &#8216;socialite&#8217;\n<pre class=\"lang:default decode:true \">vagrant@homestead:~$ cd Code\/\r\nvagrant@homestead:~\/Code$ composer create-project --prefer-dist laravel\/laravel socialite\r\nInstalling laravel\/laravel (v5.3.16)\r\n  - Installing laravel\/laravel (v5.3.16)\r\n    Loading from cache\r\n...\r\n&gt; php artisan key:generate\r\nApplication key [base64:KYHaOwFIHGLog5xgPO5v1qjP\/MDMKO9OL6ajTQGdQ4Q=] set successfully.<\/pre>\n<\/li>\n<li>Test it at our browser with\u00a0http:\/\/socialite.app\/. If the laravel screen is showed up, we are on the right path.<\/li>\n<li>Go into the new project &#8216;socialite&#8217; root directory then add a dependency &#8216;laravel\/socialite&#8217;\n<pre class=\"lang:default decode:true \">vagrant@homestead:~\/Code$ cd socialite\/\r\nvagrant@homestead:~\/Code\/socialite$ composer require laravel\/socialite\r\nUsing version ^2.0 for laravel\/socialite\r\n.\/composer.json has been updated\r\nLoading composer repositories with package information\r\nUpdating dependencies (including require-dev)\r\n  - Installing guzzlehttp\/promises (1.3.0)\r\n    Loading from cache\r\n\r\n  - Installing psr\/http-message (1.0.1)\r\n    Loading from cache\r\n\r\n  - Installing guzzlehttp\/psr7 (1.3.1)\r\n    Loading from cache\r\n\r\n  - Installing guzzlehttp\/guzzle (6.2.2)\r\n    Loading from cache\r\n\r\n  - Installing league\/oauth1-client (1.7.0)\r\n    Downloading: 100%         \r\n\r\n  - Installing laravel\/socialite (v2.0.20)\r\n    Downloading: 100%         \r\n\r\nWriting lock file\r\nGenerating autoload files\r\n&gt; Illuminate\\Foundation\\ComposerScripts::postUpdate\r\n&gt; php artisan optimize\r\nGenerating optimized class loader\r\nThe compiled class file has been removed.<\/pre>\n<p>&nbsp;<\/li>\n<li>Configuration<br \/>\nAfter installing the Socialite library, register the Laravel\\Socialite\\SocialiteServiceProvider in your config\/app.php configuration file:<\/p>\n<pre class=\"lang:default decode:true \">...\r\n'providers' =&gt; [\r\n\r\n    ...\r\n    Laravel\\Socialite\\SocialiteServiceProvider::class,\r\n\r\n],\r\n...<\/pre>\n<p>Also, add the Socialite facade to the aliases array in your app configuration file:<\/p>\n<pre class=\"lang:default decode:true \">...\r\n'aliases' =&gt; [\r\n\r\n    ...\r\n    'Socialite' =&gt; Laravel\\Socialite\\Facades\\Socialite::class,\r\n\r\n],\r\n...<\/pre>\n<p>&nbsp;<\/li>\n<li>You will also need to add credentials for the OAuth services your application utilizes. These credentials should be placed in your config\/services.php configuration file, and should use the key facebook, twitter, linkedin, google, github or bitbucket, depending on the providers your application requires. For example for facebook credentials:\n<pre class=\"lang:default decode:true \">&lt;?php\r\n\r\nreturn [\r\n\r\n    ...\r\n    \r\n    'facebook' =&gt; [\r\n        'client_id' =&gt; env('FB_APP_ID'),\r\n        'client_secret' =&gt; env('FB_APP_SECRET'),\r\n        'redirect' =&gt; env('FB_REDIRECT'),\r\n    ],\r\n\r\n];<\/pre>\n<p>we will use env file (.env) to store facebook credentials.<\/p>\n<pre class=\"lang:default decode:true\">FB_APP_ID=xxxxxxx\r\nFB_APP_SECRET=xxxxxx\r\nFB_REDIRECT=http:\/\/socialite.app\/auth\/facebook\/callback<\/pre>\n<p><span class=\"rcp-restricted-content-message\">SORRY, ONLY ADMIN CAN SHOW THIS!<\/span><br \/>\nREMEMBER &#8216;http:\/\/socialite.app\/auth\/facebook\/callback&#8217; IS CALLBACK URL (AFTER THE SUCCESSFUL LOGIN ON FACEBOOK). ALSO IT MUST MATCH WITH ROUTE &#8216;auth\/facebook\/callback&#8217; IN \/routes\/web.php LATER!<\/li>\n<li>Basic Usage<br \/>\nNext, you are ready to authenticate users! You will need two routes: one for redirecting the user to the OAuth provider, and another for receiving the callback from the provider after authentication. We will access Socialite using the Socialite facade. Please create a new controller file &#8216;AuthController.php&#8217; in \/app\/Http\/Controllers\/Auth\/ to work with facebook login:<\/p>\n<pre class=\"lang:default decode:true\">&lt;?php\r\n\r\nnamespace App\\Http\\Controllers\\Auth;\r\n\r\nuse App\\Http\\Controllers\\Controller;\r\nuse Socialite;\r\n\r\nclass AuthController extends Controller\r\n{\r\n    \/**\r\n     * Redirect the user to the GitHub authentication page.\r\n     *\r\n     * @return Response\r\n     *\/\r\n    public function redirectToProvider()\r\n    {\r\n        return Socialite::driver('facebook')-&gt;redirect();\r\n    }\r\n\r\n    \/**\r\n     * Obtain the user information from GitHub.\r\n     *\r\n     * @return Response\r\n     *\/\r\n    public function handleProviderCallback()\r\n    {\r\n        $user = Socialite::driver('facebook')-&gt;user();\r\n        \/\/var_dump($user);\r\n        \/\/ $user-&gt;token;\r\n        $data=array(\r\n            'name'=&gt;$user-&gt;name,\r\n            'login_via'=&gt;'Facebook'\r\n        );\r\n        \r\n        return view('home')-&gt;with('data',$data); \r\n        \/\/return redirect()-&gt;to('\/')-&gt;with('data',$data);\r\n    }\r\n}<\/pre>\n<p>NOTE: DONT FORGET TO ADD &#8216;use App\\Http\\Controllers\\Controller;&#8217; BEFORE &#8216;use Socialite;&#8217; BECAUSE I GOT AN ERROR ABOUT IT!<\/li>\n<li>Creating Views. Create two new blade files. They are \/resources\/views\/home.blade.php and \/resources\/views\/master.blade.php:<br \/>\nmaster.blade.php:<\/p>\n<pre class=\"lang:default decode:true \">&lt;!doctype html&gt;\r\n&lt;html lang=\"en\"&gt;\r\n&lt;head&gt;\r\n    &lt;meta charset=\"UTF-8\"&gt;\r\n    &lt;meta name=\"_token\" content=\"{{ csrf_token() }}\"\/&gt;\r\n    &lt;title&gt;Social Login&lt;\/title&gt;\r\n    &lt;link href=\"https:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/3.3.5\/css\/bootstrap.min.css\" rel=\"stylesheet\"&gt;\r\n    &lt;style&gt;\r\n        body {\r\n            padding-top : 70px;\r\n        }\r\n    &lt;\/style&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n    &lt;div class=\"container\"&gt;\r\n        @yield('content')\r\n    &lt;\/div&gt;\r\n\r\n    &lt;script src=\"http:\/\/code.jquery.com\/jquery-2.1.4.min.js\"&gt;&lt;\/script&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p>home.blade.php:<\/p>\n<pre class=\"lang:default decode:true\">@extends('master')\r\n\r\n@section('content')\r\n    @if(!empty($data))\r\n    &lt;h1&gt;Hello {{$data['name']}}, You logged in via {{ $data['login_via'] }}&lt;\/h1&gt;\r\n    @else\r\n    &lt;div class=\"row\"&gt;\r\n        &lt;div class=\"col-md-6 col-md-offset-3\"&gt;\r\n            &lt;h2&gt;Login Using Social Sites&lt;\/h2&gt;\r\n            &lt;a class=\"btn btn-primary\" href=\"{{ url('\/auth\/facebook') }}\"&gt;Facebook&lt;\/a&gt;\r\n        &lt;\/div&gt;\r\n    &lt;\/div&gt;\r\n    @endif\r\n@stop<\/pre>\n<p>url(&#8216;\/auth\/facebook&#8217;) would redirect the page to facebookpage!<\/li>\n<li>Set the routes. Edit \/routes\/web.php like this:\n<pre class=\"lang:default decode:true\">Route::get('\/', function () {\r\n    \/\/return view('welcome');\r\n    return view('home');\r\n});\r\n\r\nRoute::get('auth\/facebook', 'Auth\\AuthController@redirectToProvider');\r\nRoute::get('auth\/facebook\/callback', 'Auth\\AuthController@handleProviderCallback');<\/pre>\n<p>We set the root (&#8216;\/&#8217;) url would open the home page (home.blade.php)<\/li>\n<li>Test it! http:\/\/socialite.app\/<br \/>\nHere is the screen<a href=\"http:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-home.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1050\" src=\"http:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-home.png\" alt=\"socialite-home\" width=\"568\" height=\"231\" srcset=\"https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-home.png 568w, https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-home-300x122.png 300w\" sizes=\"auto, (max-width: 568px) 85vw, 568px\" \/><\/a>If we click &#8216;Facebook&#8217; link, it would redirect us to facebook page. The url would be like this:\u00a0https:\/\/www.facebook.com\/v2.8\/dialog\/oauth?client_id=166568033366882&amp;redirect_uri=http%3A%2F%2Fsocialite.app&amp;scope=email&amp;response_type=code&amp;state=es6ub834Woh7xDxTvdqru84U7kwiRJkftD83HFz7<br \/>\nIf I get this page<a href=\"http:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-fb-page.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1051\" src=\"http:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-fb-page.png\" alt=\"socialite-fb-page\" width=\"916\" height=\"420\" srcset=\"https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-fb-page.png 916w, https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-fb-page-300x138.png 300w, https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-fb-page-768x352.png 768w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/a> Then I need to modify my facebook app to add this domain (http:\/\/socialite.app\/) at &#8216;Site URL&#8217; box. To do it, Open your app from https:\/\/developers.facebook.com\/apps, then Click your app. Then at Settings-&gt;Basic-&gt;at Site Url fill with this domain name: http:\/\/socialite.app\/. Then Save and fix any error.<br \/>\n<span class=\"rcp-restricted-content-message\">SORRY, ONLY ADMIN CAN SHOW THIS!<\/span><br \/>\nHere is the oauth2 output from facebook for successful login:<br \/>\n<span class=\"rcp-restricted-content-message\">SORRY, ONLY ADMIN CAN SHOW THIS!<\/span><br \/>\nHere is the callback result the successful facebook login<a href=\"http:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-fb-callback.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1064\" src=\"http:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-fb-callback.png\" alt=\"socialite-fb-callback\" width=\"892\" height=\"211\" srcset=\"https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-fb-callback.png 892w, https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-fb-callback-300x71.png 300w, https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-fb-callback-768x182.png 768w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/a><\/li>\n<li>How to add the others social links (twitter, github, google plus and linkedin)?<br \/>\nPlease read Complete <a href=\"http:\/\/devartisans.com\/articles\/complete-laravel5-socialite-tuorial\" target=\"_blank\">Laravel 5 Socialite tutorial<\/a> to find out how to do it.<br \/>\nYou need to setup your apps for the above social app to get the credentials like Client ID and Client Secret and the redirect URL.<br \/>\nTo setup Google+ app, please read <a href=\"http:\/\/myprojects.advchaweb.com\/index.php\/2016\/11\/26\/google-apis\/\" target=\"_blank\">Google APIs<\/a><br \/>\nTo setup twitter app, please read <a href=\"http:\/\/myprojects.advchaweb.com\/index.php\/2016\/11\/26\/twitter-socialite-app\/\" target=\"_blank\">Twitter Socialite App<\/a><br \/>\nTo setup github app, please read <a href=\"http:\/\/myprojects.advchaweb.com\/index.php\/2016\/11\/26\/github-app\/\" target=\"_blank\">Github App<\/a><br \/>\nTo setup linkedin app, please read <a href=\"http:\/\/myprojects.advchaweb.com\/index.php\/2016\/11\/26\/linkedin-oauth2-app\/\" target=\"_blank\">Linkedin Oauth2 App<\/a><br \/>\nThen modify .env file to include above credentials:<br \/>\n<span class=\"rcp-restricted-content-message\">SORRY, ONLY ADMIN CAN SHOW THIS!<\/span><\/li>\n<li>Here I want to make the redirect URL to be uniform like this:\n<pre class=\"lang:default decode:true \">FB_APP_ID=XXX\r\nFB_APP_SECRET=XXX\r\nFB_REDIRECT=http:\/\/socialite.app\/social\/login\/facebook\r\n\r\nGOOGLE_APP_ID=XXX\r\nGOOGLE_APP_SECRET=XXX\r\nGOOGLE_REDIRECT=http:\/\/socialite.app\/social\/login\/google\r\n\r\nTWITTER_APP_ID=XXX\r\nTWITTER_APP_SECRET=XXX\r\nTWITTER_REDIRECT=http:\/\/socialite.app\/social\/login\/twitter\r\n\r\nGITHUB_APP_ID=XXX\r\nGITHUB_APP_SECRET=XXX\r\nGITHUB_REDIRECT=http:\/\/socialite.app\/social\/login\/github\r\n\r\nLINKEDIN_APP_ID=XXX\r\nLINKEDIN_APP_SECRET=XXX\r\nLINKEDIN_REDIRECT=http:\/\/socialite.app\/social\/login\/linkedin<\/pre>\n<p>So modify our social routes in \/routes\/web.app like this:<\/p>\n<pre class=\"lang:default decode:true \">Route::get('social\/login\/redirect\/{provider}', ['uses' =&gt; 'Auth\\AuthController@redirectToProvider', 'as' =&gt; 'social.login']);\r\nRoute::get('social\/login\/{provider}', 'Auth\\AuthController@handleProviderCallback');<\/pre>\n<p>&nbsp;<\/li>\n<li>Modify \/config\/services.php to get all the credentials from .env file\n<pre class=\"lang:default decode:true \">&lt;?php\r\n\r\nreturn [\r\n\r\n    ...\r\n    \r\n    'facebook' =&gt; [\r\n        'client_id' =&gt; env('FB_APP_ID'),\r\n        'client_secret' =&gt; env('FB_APP_SECRET'),\r\n        'redirect' =&gt; env('FB_REDIRECT'),\r\n    ],\r\n    \r\n    'twitter' =&gt; [\r\n        'client_id' =&gt; env('TWITTER_APP_ID'),\r\n        'client_secret' =&gt; env('TWITTER_APP_SECRET'),\r\n        'redirect' =&gt; env('TWITTER_REDIRECT'),\r\n    ],\r\n    \r\n    'google' =&gt; [\r\n        'client_id' =&gt; env('GOOGLE_APP_ID'),\r\n        'client_secret' =&gt; env('GOOGLE_APP_SECRET'),\r\n        'redirect' =&gt; env('GOOGLE_REDIRECT'),\r\n    ],\r\n    \r\n    'github' =&gt; [\r\n        'client_id' =&gt; env('GITHUB_APP_ID'),\r\n        'client_secret' =&gt; env('GITHUB_APP_SECRET'),\r\n        'redirect' =&gt; env('GITHUB_REDIRECT'),\r\n    ],\r\n    \r\n    'linkedin' =&gt; [\r\n        'client_id' =&gt; env('LINKEDIN_APP_ID'),\r\n        'client_secret' =&gt; env('LINKEDIN_APP_SECRET'),\r\n        'redirect' =&gt; env('LINKEDIN_REDIRECT'),\r\n    ],\r\n\r\n];\r\n<\/pre>\n<p>&nbsp;<\/li>\n<li>Modify \/resources\/views\/home.blade.php to include all the social app\n<pre class=\"lang:default decode:true \">@extends('master')\r\n\r\n@section('content')\r\n    @if(!empty($data))\r\n    &lt;h1&gt;Hello {{$data['name']}}, You logged in via {{ $data['login_via'] }}&lt;\/h1&gt;\r\n    @else\r\n    &lt;div class=\"row\"&gt;\r\n        &lt;div class=\"col-md-6 col-md-offset-3\"&gt;\r\n            &lt;h2&gt;Login Using Social Sites&lt;\/h2&gt;\r\n            &lt;a class=\"btn btn-primary\" href=\"{{ route('social.login','facebook') }}\"&gt;Facebook&lt;\/a&gt;\r\n            &lt;a class=\"btn btn-primary\" href=\"{{ route('social.login','twitter') }}\"&gt;Twitter&lt;\/a&gt;\r\n            &lt;a class=\"btn btn-primary\" href=\"{{ route('social.login','google') }}\"&gt;Google+&lt;\/a&gt;\r\n            &lt;a class=\"btn btn-primary\" href=\"{{ route('social.login','github') }}\"&gt;Github&lt;\/a&gt;\r\n            &lt;a class=\"btn btn-primary\" href=\"{{ route('social.login','linkedin') }}\"&gt;Linkedin&lt;\/a&gt;\r\n        &lt;\/div&gt;\r\n    &lt;\/div&gt;\r\n    @endif\r\n@stop<\/pre>\n<\/li>\n<li>Modify \/app\/Http\/Controllers\/Auth\/AuthController.php to add a parameter $provider\n<pre class=\"lang:default decode:true \">...\r\n\r\nclass AuthController extends Controller\r\n{\r\n    public function redirectToProvider($provider)\r\n    {\r\n        return Socialite::driver($provider)-&gt;redirect();\r\n    }\r\n\r\n    public function handleProviderCallback($provider)\r\n    {\r\n        $user = Socialite::driver($provider)-&gt;user();\r\n        $data=array(\r\n            'name'=&gt;$user-&gt;name,\r\n            'login_via'=&gt;$provider\r\n        );\r\n        \r\n        return view('home')-&gt;with('data',$data); \r\n    }\r\n}<\/pre>\n<\/li>\n<li>Run on your browser<a href=\"http:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-home-muti.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1112\" src=\"http:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-home-muti.png\" alt=\"socialite-home-muti\" width=\"637\" height=\"246\" srcset=\"https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-home-muti.png 637w, https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-home-muti-300x116.png 300w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><\/a><span style=\"background-color: #008000;\">Login via Facebook<\/span> RUN WELL LIKE BEFORE!<br \/>\n<span style=\"background-color: #008000;\">Login via Twitter<\/span>, For the first time we are needed to authorize the application<a href=\"http:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-twitter-autorize.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1113\" src=\"http:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-twitter-autorize.png\" alt=\"socialite-twitter-autorize\" width=\"719\" height=\"509\" srcset=\"https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-twitter-autorize.png 719w, https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-twitter-autorize-300x212.png 300w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><\/a>Click &#8216;Authorize app&#8217;. If nothing wrong, here is the callback result<a href=\"http:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-twitter-callback.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1114\" src=\"http:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-twitter-callback.png\" alt=\"socialite-twitter-callback\" width=\"853\" height=\"119\" srcset=\"https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-twitter-callback.png 853w, https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-twitter-callback-300x42.png 300w, https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-twitter-callback-768x107.png 768w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/a><span class=\"rcp-restricted-content-message\">SORRY, ONLY ADMIN CAN SHOW THIS!<\/span><br \/>\n<span style=\"background-color: #008000;\">Login via Google<\/span>, For the first time we are needed to authorize the application<a href=\"http:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-google-autorize.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1116\" src=\"http:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-google-autorize.png\" alt=\"socialite-google-autorize\" width=\"627\" height=\"433\" srcset=\"https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-google-autorize.png 627w, https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-google-autorize-300x207.png 300w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><\/a>Click &#8216;Izinkan&#8217;. If nothing wrong, here is the callback result<a href=\"http:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-google-callback.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1117\" src=\"http:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-google-callback.png\" alt=\"socialite-google-callback\" width=\"787\" height=\"105\" srcset=\"https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-google-callback.png 787w, https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-google-callback-300x40.png 300w, https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-google-callback-768x102.png 768w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><\/a> <span class=\"rcp-restricted-content-message\">SORRY, ONLY ADMIN CAN SHOW THIS!<\/span><br \/>\n<span style=\"background-color: #008000;\">Login via Github<\/span>, For the first time we are needed to authorize the application<a href=\"http:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-github-autorize.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1119\" src=\"http:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-github-autorize.png\" alt=\"socialite-github-autorize\" width=\"1020\" height=\"485\" srcset=\"https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-github-autorize.png 1020w, https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-github-autorize-300x143.png 300w, https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-github-autorize-768x365.png 768w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/a>Click &#8216;Authorize application&#8217;. If nothing wrong, here is the callback result<a href=\"http:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-github-callback.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1120\" src=\"http:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-github-callback.png\" alt=\"socialite-github-callback\" width=\"796\" height=\"98\" srcset=\"https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-github-callback.png 796w, https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-github-callback-300x37.png 300w, https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-github-callback-768x95.png 768w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><\/a><span class=\"rcp-restricted-content-message\">SORRY, ONLY ADMIN CAN SHOW THIS!<\/span><br \/>\n<span style=\"background-color: #008000;\">Login via Linkedin<\/span>, For the first time we are needed to authorize the application<a href=\"http:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-linkedin-autorize.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1126\" src=\"http:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-linkedin-autorize.png\" alt=\"socialite-linkedin-autorize\" width=\"436\" height=\"498\" srcset=\"https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-linkedin-autorize.png 436w, https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-linkedin-autorize-263x300.png 263w\" sizes=\"auto, (max-width: 436px) 85vw, 436px\" \/><\/a>Click &#8216;Allow&#8217;. If nothing wrong, here is the callback result<a href=\"http:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-linkedin-callback.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1127\" src=\"http:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-linkedin-callback.png\" alt=\"socialite-linkedin-callback\" width=\"775\" height=\"93\" srcset=\"https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-linkedin-callback.png 775w, https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-linkedin-callback-300x36.png 300w, https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2016\/11\/socialite-linkedin-callback-768x92.png 768w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><\/a><span class=\"rcp-restricted-content-message\">SORRY, ONLY ADMIN CAN SHOW THIS!<\/span><\/li>\n<li>OKAY! EVERYTHING RUN WELL. THE NEXT STEP IS TO USE DATABASE\/SESSION TO SAVE THE LOGIN INFORMATION!<br \/>\nFor this, please read : <a href=\"https:\/\/blog.damirmiladinov.com\/laravel\/laravel-5.2-socialite-facebook-login.html#.WDf1JHV97rc\" target=\"_blank\">Laravel 5.2 Socialite Facebook Login<\/a> and <a href=\"https:\/\/mattstauffer.co\/blog\/using-github-authentication-for-login-with-laravel-socialite\" target=\"_blank\">Using Github authentication for login with Laravel Socialite<\/a>.<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Source: https:\/\/github.com\/laravel\/socialite I want to practice &#8216;socialite&#8217; app given by Laravel 5.3 documentation. Installation: Open hosts file and Add a new domain &#8216;socialite.app&#8217; at the file teddy@teddy-K43SJ:~\/Homestead$ sudo gedit \/etc\/hosts Add this line in the file: 192.168.10.10 socialite.app Edit &#8216;Homestead.yaml&#8217; file in ~\/.homestead\/ to add the new domain &#8216;socialite.app&#8217; and set the mapping &#8230; sites: &hellip; <a href=\"https:\/\/myprojects.advchaweb.com\/index.php\/2016\/11\/25\/laravel-socialite\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Laravel Socialite&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14,13],"tags":[],"class_list":["post-1044","post","type-post","status-publish","format-standard","hentry","category-laravel","category-tutorial"],"_links":{"self":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts\/1044","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/comments?post=1044"}],"version-history":[{"count":24,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts\/1044\/revisions"}],"predecessor-version":[{"id":1130,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts\/1044\/revisions\/1130"}],"wp:attachment":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/media?parent=1044"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/categories?post=1044"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/tags?post=1044"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}