项目作者: SocialiteProviders

项目描述 :
[READ ONLY] Subtree split of the SocialiteProviders/Discogs Provider (see SocialiteProviders/Providers)
高级语言: PHP
项目地址: git://github.com/SocialiteProviders/Discogs.git
创建时间: 2017-12-04T08:59:38Z
项目社区:https://github.com/SocialiteProviders/Discogs

开源协议:

下载


Discogs

  1. composer require socialiteproviders/discogs

Installation & Basic Usage

Please see the Base Installation Guide, then follow the provider specific instructions below.

Add configuration to config/services.php

  1. 'discogs' => [
  2. 'client_id' => env('DISCOGS_CLIENT_ID'),
  3. 'client_secret' => env('DISCOGS_CLIENT_SECRET'),
  4. 'redirect' => env('DISCOGS_REDIRECT_URI')
  5. ],

Add provider event listener

Laravel 11+

In Laravel 11, the default EventServiceProvider provider was removed. Instead, add the listener using the listen method on the Event facade, in your AppServiceProvider boot method.

  • Note: You do not need to add anything for the built-in socialite providers unless you override them with your own providers.
  1. Event::listen(function (\SocialiteProviders\Manager\SocialiteWasCalled $event) {
  2. $event->extendSocialite('discogs', \SocialiteProviders\Discogs\Provider::class);
  3. });


Laravel 10 or below

Configure the package’s listener to listen for SocialiteWasCalled events.

Add the event to your listen[] array in app/Providers/EventServiceProvider. See the Base Installation Guide for detailed instructions.

php protected $listen = [ \SocialiteProviders\Manager\SocialiteWasCalled::class => [ // ... other providers \SocialiteProviders\Discogs\DiscogsExtendSocialite::class.'@handle', ], ];

Usage

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

  1. return Socialite::driver('discogs')->redirect();

Returned User fields

  • id
  • nickname
  • name
  • email
  • avatar