skyracer2012 / iservsocialiteprovider

IServ OAuth2 Provider for Laravel Socialite

1.0.0 2022-11-22 08:24 UTC

This package is auto-updated.

Last update: 2024-09-09 12:42:58 UTC


README

composer require skyracer2012/IServSocialiteProvider

安装与基本使用

请参阅基本安装指南,然后按照以下特定于提供者的说明操作。

config/services.php 中添加配置

'iserv' => [
  'base_uri' => env('ISERV_OID_URL'),
  'client_id' => env('ISERV_OID_CLIENT_ID'),
  'client_secret' => env('ISERV_OID_CLIENT_SECRET'),
  'redirect' => env('ISERV_OID_REDIRECT_URL'),
  'scopes' => [
    'openid',
    'profile',
    'email',
    'uuid'
  ],
]

添加提供者事件监听器

配置包的监听器以监听 SocialiteWasCalled 事件。

app/Providers/EventServiceProvider 中的 listen[] 数组中添加事件。有关详细说明,请参阅基本安装指南

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

使用方法

现在您应该能够像平时使用 Socialite 一样使用此提供者(假设您已安装 facade)

return Socialite::driver('iserv')->redirect();

返回的用户字段

  • id
  • email
  • username
  • name