PHP code example of rinkp / socialite-azure-b2c

1. Go to this page and download the library: Download rinkp/socialite-azure-b2c 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/ */

    

rinkp / socialite-azure-b2c example snippets


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

class EventServiceProvider extends ServiceProvider
{
    /**
     * ...
     */
    protected $listen = [
        /* ... */

        \SocialiteProviders\Manager\SocialiteWasCalled::class => [
            'SocialiteProviders\\AzureB2C\\AzureB2CExtendSocialite@handle',
        ],

        Illuminate\Auth\Events\Logout::class => [
            'SocialiteProviders\\AzureB2C\\AzureB2CExtendSocialite@logOut',
        ],

        /* ... */
    ];
}

return [
    /* ... */

    'azureb2c' => [
        'client_id' => env('AZUREB2C_CLIENT_ID'),
        'client_secret' => env("AZUREB2C_CLIENT_SECRET"),
        'redirect' => env("AZUREB2C_REDIRECT_URL"),
        'redirect_logout' => env("AZUREB2C_LOGOUT_URL"),
        'tenant' => env("AZUREB2C_TENANT", env("AZUREB2C_TENANT_NAME") . ".onmicrosoft.com"),
        'tenant_name' => env("AZUREB2C_TENANT_NAME"),
        'flow_name' => env("AUZREB2C_FLOW_NAME"),
        'cache_time' => env("AUZREB2C_CACHE_TIME")
    ],

    /* ... */
];