2017 © Pedro Peláez
 

library socialite-naszaklasa

NaszaKlasa OAuth2 Provider for Laravel Socialite

image

hellkid/socialite-naszaklasa

NaszaKlasa OAuth2 Provider for Laravel Socialite

  • Tuesday, March 28, 2017
  • by hellkid
  • Repository
  • 1 Watchers
  • 1 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Nasza Klasa (http://nk.pl) OAuth2 Provider for Laravel Socialite

Documentation

This package is based on awesome packages by Socialite Providers, (*1)

You can always refer to their docs if you need more info on how to use this package., (*2)

INSTALLATION

1. COMPOSER

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

composer require hellkid/socialite-naszaklasa, (*4)

2. SERVICE PROVIDER

Remove Laravel\Socialite\SocialiteServiceProvider from your providers[] array in config\app.php if you have added it already., (*5)

Add \SocialiteProviders\Manager\ServiceProvider::class to your providers[] array in config\app.php., (*6)

For example:, (*7)

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

Note: If you would like to use the Socialite Facade, you need to install it., (*8)

3. ADD THE EVENT AND LISTENERS

Add SocialiteProviders\Manager\SocialiteWasCalled event to your listen[] array in <app_name>/Providers/EventServiceProvider., (*9)

Add your listeners (i.e. the ones from the providers) to the SocialiteProviders\Manager\SocialiteWasCalled[] that you just created., (*10)

The listener that you add for this provider is 'Hellkid\Hellkid\SocialiteNaszaklasa\NaszaKlasaExtendSocialite@handle',., (*11)

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

For example:, (*13)

/**
 * The event handler mappings for the application.
 *
 * @var array
 */
protected $listen = [
    \SocialiteProviders\Manager\SocialiteWasCalled::class => [
        // add your listeners (aka providers) here
        'Hellkid\Hellkid\SocialiteNaszaklasa\NaszaKlasaExtendSocialite@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., (*14)

APPEND PROVIDER VALUES TO YOUR .ENV FILE, (*15)

// other values above
NASZAKLASA_KEY=yourkeyfortheservice
NASZAKLASA_SECRET=yoursecretfortheservice
NASZAKLASA_REDIRECT_URI=https://example.com/login   

ADD TO CONFIG/SERVICES.PHP., (*16)

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

'naszaklasa' => [
    'client_id' => env('NASZAKLASA_KEY'),
    'client_secret' => env('NASZAKLASA_SECRET'),
    'redirect' => env('NASZAKLASA_REDIRECT_URI'),  
], 

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

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

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

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

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

The Versions

28/03 2017

dev-master

9999999-dev

NaszaKlasa OAuth2 Provider for Laravel Socialite

  Sources   Download

MIT

The Requires

 

The Development Requires

by Evgeniy Bazarov