PHP code example of bbs-lab / filament-okta

1. Go to this page and download the library: Download bbs-lab/filament-okta 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/ */

    

bbs-lab / filament-okta example snippets


use BBSLab\FilamentOkta\OktaPlugin;
use Filament\Panel;

public function panel(Panel $panel): Panel
{
    return $panel
        // …
        ->login()
        ->plugin(OktaPlugin::make());
}

'okta' => [
    'client_id' => env('OKTA_CLIENT_ID'),
    'client_secret' => env('OKTA_CLIENT_SECRET'),
    'redirect' => env('OKTA_REDIRECT_URI'), // optional — derived per panel from its callback route
    'base_url' => env('OKTA_BASE_URL'),
],

->plugin(
    OktaPlugin::make()
        ->socialiteDriver('okta-admin')   // a distinct registered driver (own Okta app)
        ->ssoLogout(true)                 // logout ends the Okta session (OIDC end-session)
        ->ths (after the panel path); omit any to keep its default
            login: 'authorization-code/redirect',
            callback: 'authorization-code/callback',
            logout: 'authorization-code/logout',
            callbackLogout: 'authorization-code/callback/logout',
        ),
)

use Illuminate\Support\Facades\Event;
use SocialiteProviders\Manager\SocialiteWasCalled;
use SocialiteProviders\Okta\Provider;

Event::listen(fn (SocialiteWasCalled $event) => $event->extendSocialite('okta-admin', Provider::class));

'okta-admin' => [
    'client_id' => env('OKTA_ADMIN_CLIENT_ID'),
    'client_secret' => env('OKTA_ADMIN_CLIENT_SECRET'),
    'redirect' => env('OKTA_ADMIN_REDIRECT_URI'), // optional — derived from the panel callback
    'base_url' => env('OKTA_ADMIN_BASE_URL'),
],