mrstebo/socialite-provider-ekm

EKM OAuth2 Provider for Laravel Socialite

0.3.0 2022-01-30 09:44 UTC

This package is auto-updated.

Last update: 2024-10-29 05:59:42 UTC


README

This provider is for Socialite 5

This is for testing the EKM provider before it is merged into the Socialite Providers repository

Packagist Software License

EKM

composer require mrstebo/socialite-provider-ekm

Installation & Basic Usage

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

Add configuration to config/services.php

'ekm' => [
  'client_id' => env('EKM_CLIENT_ID'),
  'client_secret' => env('EKM_CLIENT_SECRET'),
  'redirect' => env('EKM_REDIRECT_URI'),
  'scopes' => [
      'openid',
      'profile',
      // Additional scopes
  ]
],

The openid and profile scopes must be set in order to get an EKM users profile

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\\EKM\\EKMExtendSocialite@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('ekm')
            ->with(['prompt' => 'login'])
            ->scopes(config('services.ekm.scopes'))
            ->redirect();