2017 © Pedro Peláez
 

library steein-laravel-oauth

Steein OAuth2 Provider for Laravel Socialite

image

steeinpassport/steein-laravel-oauth

Steein OAuth2 Provider for Laravel Socialite

  • Friday, July 14, 2017
  • by codeljack
  • Repository
  • 0 Watchers
  • 0 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Steein OAuth2 Provider for Laravel Socialite

Installation

0. Credentials

Obtain your app ID and secret from www.steein.ru. You must set up a valid name and callback URL., (*1)

1. Composer

This assumes that you have composer installed globally:, (*2)

composer require steeinpassport/steein-laravel-oauth

2. Service Provider

Remove Laravel\Socialite\SocialiteServiceProvider from your providers[] array in config\app.php if you have added it already. Add \SocialiteProviders\Manager\ServiceProvider::class to your providers[] array in config\app.php. For example:, (*3)

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

3. Add the Event and Listeners

Add SocialiteProviders\Manager\SocialiteWasCalled event to your listen[] array in <app_name>/Providers/EventServiceProvider. Add your listeners (i.e. the ones from the providers) to the SocialiteProviders\Manager\SocialiteWasCalled[] that you just created. The listener that you add for this provider is 'SocialiteProviders\Steein\SteeinExtendSocialite@handle',., (*4)

Note: You do not need to add anything for the built-in socialite providers unless you override them with your own providers., (*5)

For example:, (*6)

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

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., (*7)

Append provider values to your .env file

// other values above
STEEIN_KEY=yourkeyfortheservice
STEEIN_SECRET=yoursecretfortheservice
STEEIN_REDIRECT_URI=https://example.com/login/callback

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, (*8)

'steein' => [
    'client_id' => env('STEEIN_KEY'),
    'client_secret' => env('STEEIN_SECRET'),
    'redirect' => env('STEEIN_REDIRECT_URI'),  
]

Usage

You should now be able to use it like you would regularly use Socialite (assuming you have the facade installed):, (*9)

    return Socialite::with('steein')->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., (*10)

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

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)., (*12)

Stateless, (*13)

You can set whether or not you want to use the provider as stateless. Remember that the OAuth provider (Twitter, Tumblr, etc) must support whatever option you choose., (*14)

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

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

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

The Versions

14/07 2017

dev-master

9999999-dev

Steein OAuth2 Provider for Laravel Socialite

  Sources   Download

MIT

The Requires

 

by Avatar codeljack

authorization auth login socialite steein

14/07 2017

v1.2

1.2.0.0

Steein OAuth2 Provider for Laravel Socialite

  Sources   Download

MIT

The Requires

 

by Avatar codeljack

authorization auth login socialite steein

14/07 2017

v1.1

1.1.0.0

Steein OAuth2 Provider for Laravel Socialite

  Sources   Download

MIT

The Requires

 

by Codefuhrer

authorization auth login socialite steein

14/07 2017

dev-v.1.0

dev-v.1.0

Steein OAuth2 Provider for Laravel Socialite

  Sources   Download

MIT

The Requires

 

by Codefuhrer

authorization auth login socialite steein