PHP code example of adamwathan / eloquent-oauth-l4
1. Go to this page and download the library: Download adamwathan/eloquent-oauth-l4 library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use \AdamWathan\EloquentOAuth\Exceptions\ApplicationRejectedException;
use \AdamWathan\EloquentOAuth\Exceptions\InvalidAuthorizationCodeException;
Route::get('facebook/login', function() {
try {
OAuth::login('facebook');
} catch (ApplicationRejectedException $e) {
// User rejected application
} catch (InvalidAuthorizationCodeException $e) {
// Authorization was attempted with invalid
// code,likely forgery attempt
}
// Current user is now available via Auth facade
$user = Auth::user();
return Redirect::intended();
});