PHP code example of pstrax / socialite-azure-government

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

    

pstrax / socialite-azure-government example snippets


'azuregov' => [    
  'client_id' => env('AZURE_CLIENT_ID'),
  'client_secret' => env('AZURE_CLIENT_SECRET'),
  'redirect' => env('AZURE_REDIRECT_URI'),
  'tenant' => env('AZURE_TENANT_ID'),
  'proxy' => env('PROXY')  // optionally
],

protected $listen = [
    \SocialiteProviders\Manager\SocialiteWasCalled::class => [
        // ... other providers
        \SocialiteProviders\Azuregov\AzureGovExtendSocialite::class.'@handle',
    ],
];

return Socialite::driver('azuregov')->redirect();

public function logout(Request $request) 
{
     Auth::guard()->logout();
     $request->session()->flush();
     $azureLogoutUrl = Socialite::driver('azuregov')->getLogoutUrl(route('login'));
     return redirect($azureLogoutUrl);
}