PHP code example of socialiteproviders / zitadel

1. Go to this page and download the library: Download socialiteproviders/zitadel 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/ */

    

socialiteproviders / zitadel example snippets


'zitadel' => [
  'client_id' => env('ZITADEL_CLIENT_ID'),
  'client_secret' => env('ZITADEL_CLIENT_SECRET'),
  'redirect' => env('ZITADEL_REDIRECT_URI'),
  'base_url' => env('ZITADEL_BASE_URL'),
  'organization_id' => env('ZITADEL_ORGANIZATION_ID'),                      // Optional
  'project_id' => env('ZITADEL_PROJECT_ID'),                                // Optional
  'post_logout_redirect_uri' => env('ZITADEL_POST_LOGOUT_REDIRECT_URI')     // Optional
],

Event::listen(function (\SocialiteProviders\Manager\SocialiteWasCalled $event) {
    $event->extendSocialite('zitadel', \SocialiteProviders\Zitadel\Provider::class);
});

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

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

$idToken = ...; // Retrieve ID token here
return redirect()->away(Socialite::driver('zitadel')->getLogoutUrl($idToken));