caesar-dev/socialite-provider-word-press-custom-endpoint

WordPress OAuth2 Provider for Laravel Socialite

4.2 2021-01-29 14:13 UTC

This package is auto-updated.

Last update: 2024-04-04 15:00:26 UTC


README

We use it for https://wp-oauth.com/ (I think so at least)

composer require CaesarDev/SocialiteProviderWordPressCustomEndpoint

Installation & Basic Usage

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

Add configuration to config/services.php

'wordpress' => [
    'client_id' => env('WORDPRESS_KEY'),
    'client_secret' => env('WORDPRESS_SECRET'),
    'redirect' => env('WORDPRESS_REDIRECT_URI'),  
    'api_top_endpoint' => env('WORDPRESS_API_TOP_ENDPOINT'),
    'api_endpoint' => env('WORDPRESS_API_ENDPOINT'),
],

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
        'CaesarDev\\SocialiteProviderWordPressCustomEndpoint\\WordPressExtendSocialite@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('wordpress')->redirect();

Returned User fields

  • id
  • nickname
  • name
  • email
  • avatar