Contents of ProjectV


1. Composer

// This assumes that you have composer installed globally
composer require socialiteproviders/projectv

2. Service Provider

For example:

'providers' => [
    // a whole bunch of providers
    // remove 'Laravel\Socialite\SocialiteServiceProvider',
    \SocialiteProviders\Manager\ServiceProvider::class, // add

3. Add the Event and Listeners

For example:

 * The event handler mappings for the application.
 * @var array
protected $listen = [
    \SocialiteProviders\Manager\SocialiteWasCalled::class => [
        // add your listeners (aka providers) here


4. Configuration setup

For development purpose, needed configuration is automatically retrieved from your .env if they are written as exactly shown below. However we recommend to manually add an entry to the services configuration file because after config files are cached for usage in production environment (Laravel command artisan config:cache), values stored in the .env file are not accessible anymore by the application and the provider won’t work.

Append provider values to your .env file

// other values above

Add to config/services.php.

'projectv' => [
    'client_id' => env('PROJECTV_KEY'),
    'client_secret' => env('PROJECTV_SECRET'),
    'redirect' => env('PROJECTV_REDIRECT_URI'),  



return Socialite::with('projectv')->redirect();

Lumen Support

You can use Socialite providers with Lumen. Just make sure that you have facade support turned on and that you follow the setup directions properly.

Note: If you are using this with Lumen, all providers will automatically be stateless since Lumen does not keep track of state.

Also, configs cannot be parsed from the services[] in Lumen. You can only set the values in the .env file as shown exactly in this document. If needed, you can also override a config (shown below).


Note: If you are using this with Lumen, all providers will automatically be stateless since Lumen does not keep track of state.

// to turn off stateless
return Socialite::with('projectv')->stateless(false)->redirect();

// to use stateless
return Socialite::with('projectv')->stateless()->redirect();

Overriding a config

If you need to override the provider’s environment or config variables dynamically anywhere in your application, you may use the following:

$clientId = "secret";
$clientSecret = "secret";
$redirectUrl = "";
$additionalProviderConfig = ['site' => ''];
$config = new \SocialiteProviders\Manager\Config($clientId, $clientSecret, $redirectUrl, $additionalProviderConfig);
return Socialite::with('projectv')->setConfig($config)->redirect();

Retrieving the Access Token Response Body

Laravel Socialite by default only allows access to the access_token. Which can be accessed via the \Laravel\Socialite\User->token public property. Sometimes you need access to the whole response body which may contain items such as a refresh_token.

You can get the access token response body, after you called the user() method in Socialite, by accessing the property $user->accessTokenResponseBody;

$user = Socialite::driver('projectv')->user();
$accessTokenResponseBody = $user->accessTokenResponseBody;