PHP code example of numesia / laravel-franceconnect-proxy
1. Go to this page and download the library: Download numesia/laravel-franceconnect-proxy 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/ */
numesia / laravel-franceconnect-proxy example snippets
'providers' => [
// a whole bunch of providers
// remove 'Laravel\Socialite\SocialiteServiceProvider',
SocialiteProviders\Manager\ServiceProvider::class, // add
];
/**
* The event handler mappings for the application.
*
* @var array
*/
protected $listen = [
\SocialiteProviders\Manager\SocialiteWasCalled::class => [
'Numesia\LaravelFranceConnect\FranceConnectExtendSocialite@handle',
],
];
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Socialite;
class LoginController extends Controller
{
/**
* Redirect the user to the FranceConnect authentication page.
*
* @return Response
*/
public function redirectToProvider()
{
return Socialite::driver('franceconnect')
->scopes(["identite_pivot", "address", "email", "phone", "adresse_postale"])
->redirect();
}
/**
* Obtain the user information from FranceConnect.
*
* @return Response
*/
public function handleProviderCallback()
{
$user = Socialite::driver('franceconnect')->user();
// Do something with $user
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.