Contents of Eventbrite

Installation

1. Composer

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

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
        'SocialiteProviders\Eventbrite\EventbriteExtendSocialite@handle',
    ],
];

Reference

4. Environment Variables

If you add environment values to your .env as exactly shown below, you do not need to add an entry to the services array.

Append provider values to your .env file

// other values above
EVENTBRITE_KEY=yourkeyfortheservice
EVENTBRITE_SECRET=yoursecretfortheservice
EVENTBRITE_REDIRECT_URI=https://example.com/login   

Add to config/services.php.

You do not need to add this if you add the values to the .env exactly as shown above. The values below are provided as a convenience in the case that a developer is not able to use the .env method

'eventbrite' => [
    'client_id' => env('EVENTBRITE_KEY'),
    'client_secret' => env('EVENTBRITE_SECRET'),
    'redirect' => env('EVENTBRITE_REDIRECT_URI'),  
], 

Reference

Usage

return Socialite::with('eventbrite')->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).

Stateless

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('eventbrite')->stateless(false)->redirect();

// to use stateless
return Socialite::with('eventbrite')->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 = "http://yourdomain.com/api/redirect";
$additionalProviderConfig = ['site' => 'meta.stackoverflow.com'];
$config = new \SocialiteProviders\Manager\Config($clientId, $clientSecret, $redirectUrl, $additionalProviderConfig);
return Socialite::with('eventbrite')->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('eventbrite')->user();
$accessTokenResponseBody = $user->accessTokenResponseBody;

eventbrite

Reference