PHP code example of rob-lester-jr04 / outreach

1. Go to this page and download the library: Download rob-lester-jr04/outreach library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

rob-lester-jr04 / outreach example snippets


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

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

'spotify' => [
    'client_id' => env('OUTREACH_KEY'),
    'client_secret' => env('OUTREACH_SECRET'),
    'redirect' => env('OUTREACH_REDIRECT_URI')
],

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

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

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

$clientId = "secret";
$clientSecret = "secret";
$redirectUrl = "http://yourdomain.com/api/redirect";
$additionalProviderConfig = ['site' => 'meta.stackoverflow.com'];
$config = new \SocialiteProviders\Manager\Config($clientId, $clientSecret, $redirectUrl, $additionalProviderConfig);
return Socialite::with('spotify')->setConfig($config)->redirect();

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