Convenient Webex OAuth for Laravel Projects with SocialiteNovember 17, 2021
Laravel is the most popular backend web framework with over 67k Stars on GitHub that boasts an expressive, elegant syntax and a vibrant ecosystem of projects. One such project is Laravel Socialite, which simplifies authenticating with OAuth providers, enabling a third-party application to access an HTTP service. Although out-of-the-box such support is limited to only a handful of platforms, community-driven Socialite Providers packages can easily extend compatibility to others, including Webex.
That is an exciting development since Laravel based projects can use this single, consistent interface to authenticate with Webex in addition to already supported platforms like Microsoft Azure, Auth0, Bitbucket, GitHub, Strava, Telegram, and many more! You can find the complete list of supported platforms on the project's website https://socialiteproviders.com/about. The project currently supports more than 50 platforms.
If you are already familiar with Socialite, follow the steps below to use the new Socialite Providers Webex package.
Add the package
Add the package as a project dependency using Composer:
composer require socialiteproviders/webex
Add a new service configuration
'webex' => [ 'client_id' => env('WEBEX_CLIENT_ID'), 'client_secret' => env('WEBEX_CLIENT_SECRET'), 'redirect' => env('WEBEX_REDIRECT_URI') ],
Add a new service provider
config\app.phpif you have added it already.
'providers' => [ // a whole bunch of providers // remove 'Laravel\Socialite\SocialiteServiceProvider', \SocialiteProviders\Manager\ServiceProvider::class, // add ];
Add a provider event listener
Configure the package's listener to listen for
Add the event to your
listen array in
protected $listen = [ \SocialiteProviders\Manager\SocialiteWasCalled::class => [ // ... other providers 'SocialiteProviders\\Webex\\WebexExtendSocialite@handle', ], ];
See the Base Installation Guide for detailed instructions.
You should now be able to use the provider like you would regularly use Socialite (assuming you have the facade installed):
Returned User fields
The following user fields are returned:
This article provided a brief overview of the new Socialite Providers Webex package. Laravel project owners are encouraged to use this package to simplify their workload when authenticating with Webex. To see other such community offerings or learn more about our developer platform, please visit Webex Developers.