Okta OAuth2 Provider for Laravel Socialite
2,226,734
10
4
Package Data
Maintainer Username: m1guelpf
Maintainer Contact: chase.coney@gmail.com (Chase Coney)
Package Create Date: 2017-11-21
Package Last Update: 2024-04-01
Home Page: https://socialiteproviders.com/Okta/
Language: PHP
License: MIT
Last Refreshed: 2024-04-18 15:19:50
Package Statistics
Total Downloads: 2,226,734
Monthly Downloads: 52,296
Daily Downloads: 2,565
Total Stars: 10
Total Watchers: 4
Total Forks: 8
Total Open Issues: 0

Okta

composer require socialiteproviders/okta

Installation & Basic Usage

Please see the Base Installation Guide, then follow the provider specific instructions below.

Add configuration to config/services.php

'okta' => [    
  'base_url' => env('OKTA_BASE_URL'),
  'client_id' => env('OKTA_CLIENT_ID'),  
  'client_secret' => env('OKTA_CLIENT_SECRET'),  
  'redirect' => env('OKTA_REDIRECT_URI') 
],

Custom Auth Server

If you're using Okta Developer you should set auth_server_id config option appropriately. It should be set to "default", or to the server id of your Custom Authorization Server.

For more information, see the okta docs.

Add provider event listener

Configure the package's listener to listen for SocialiteWasCalled events.

Add the event to your listen[] array in app/Providers/EventServiceProvider. See the Base Installation Guide for detailed instructions.

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

Usage

You should now be able to use the provider like you would regularly use Socialite (assuming you have the facade installed):

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

Returned User fields

  • id
  • email
  • email_verified
  • nickname
  • name
  • first_name
  • last_name
  • profileUrl
  • address
  • phone