Okta OAuth2 Provider for Laravel Socialite
2,626,732
9
4
Package Data
Maintainer Username: m1guelpf
Maintainer Contact: chase.coney@gmail.com (Chase Coney)
Package Create Date: 2017-11-21
Package Last Update: 2024-11-07
Home Page: https://socialiteproviders.com/Okta/
Language: PHP
License: MIT
Last Refreshed: 2024-11-23 03:14:49
Package Statistics
Total Downloads: 2,626,732
Monthly Downloads: 65,223
Daily Downloads: 2,799
Total Stars: 9
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