PHPackages                             numesia/laravel-franceconnect-proxy - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. numesia/laravel-franceconnect-proxy

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

numesia/laravel-franceconnect-proxy
===================================

France connect OAuth2 Provider for Laravel Socialite

2.0.1(1y ago)1822[1 issues](https://github.com/NUMESIA/laravel-franceconnect-proxy/issues)MITPHPPHP ^5.6 || ^7.0 || ^8.0

Since Dec 21Pushed 1y ago3 watchersCompare

[ Source](https://github.com/NUMESIA/laravel-franceconnect-proxy)[ Packagist](https://packagist.org/packages/numesia/laravel-franceconnect-proxy)[ RSS](/packages/numesia-laravel-franceconnect-proxy/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (9)Used By (0)

Laravel France Connect
======================

[](#laravel-france-connect)

France connect OAuth2 Provider for Laravel Socialite (proxy version).

INSTALLATION
============

[](#installation)

1. COMPOSER
-----------

[](#1-composer)

```
// This assumes that you have composer installed globally
composer require numesia/laravel-franceconnect-proxy

```

2. SERVICE PROVIDER
-------------------

[](#2-service-provider)

- Remove `Laravel\Socialite\SocialiteServiceProvider` from your `providers[]` array in `config\app.php` if you have added it already.
- Add `SocialiteProviders\Manager\ServiceProvider::class` to your `providers[]` array in `config\app.php`.

For example:

```
'providers' => [
    // a whole bunch of providers
    // remove 'Laravel\Socialite\SocialiteServiceProvider',
    SocialiteProviders\Manager\ServiceProvider::class, // add
];

```

> Note: If you would like to use the Socialite Facade, you need to [install](https://github.com/laravel/socialite) it.

3. ADD THE EVENT AND LISTENERS
------------------------------

[](#3-add-the-event-and-listeners)

- Add SocialiteProviders\\Manager\\SocialiteWasCalled event to your `listen[]` array in `/Providers/EventServiceProvider`.
- Add your listeners (i.e. the ones from the providers) to the `SocialiteProviders\Manager\SocialiteWasCalled[]` that you just created.
- The listener that you add for this provider is `'SocialiteProviders\LaravelFranceConnect\FranceConnectExtendSocialite@handle',`.

> Note: You do not need to add anything for the built-in socialite providers unless you override them with your own providers.

For example:

```
/**
 * The event handler mappings for the application.
 *
 * @var array
 */
protected $listen = [
    \SocialiteProviders\Manager\SocialiteWasCalled::class => [
        'Numesia\LaravelFranceConnect\FranceConnectExtendSocialite@handle',
    ],
];

```

4. ENVIRONMENT VARIABLES
------------------------

[](#4-environment-variables)

Append provider values to your .env file

```
// other values above
FRANCECONNECT_SANDBOX=true
FRANCECONNECT_KEY=yourkeyfortheservice
FRANCECONNECT_SECRET=yoursecretfortheservice
FRANCECONNECT_REDIRECT_URI=https://example.com/login/franceconnect/callback
FRANCECONNECT_TOKEN_MODEL=App\Models\Fctoken

```

USAGE
=====

[](#usage)

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.

```
Route::get('login/franceconnect', 'Auth\LoginController@redirectToProvider');
Route::get('login/franceconnect/callback', 'Auth\LoginController@handleProviderCallback');

```

We will access Socialite using the Socialite facade (must [install socialite](https://github.com/laravel/socialite)):

```
