newestapps/socialite-provider

Newestapps OAuth2 提供者,用于 Laravel Socialite

1.0.1 2021-06-05 19:22 UTC

This package is auto-updated.

Last update: 2024-09-06 02:31:01 UTC


README

composer require newesatpps/socialite-provider

将配置添加到 config/services.php

'newestapps' => [    
  'issuer' => env('NEWESTAPPS_OPENID_ISSUER'),  
  'client_id' => env('NEWESTAPPS_CLIENT_ID'),  
  'client_secret' => env('NEWESTAPPS_CLIENT_SECRET'),  
  'redirect' => env('NEWESTAPPS_REDIRECT_URI'),
],

添加提供者事件监听器

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

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

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

用法

现在您应该能够像常规使用 Socialite 一样使用提供者(假设您已安装了外观)

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

返回的用户字段

  • id
  • name
  • email
  • avatar