yeaggercom/socialiteprovider-apple

Laravel Socialite 的 Apple OAuth2 提供者

5.0.2 2021-03-25 22:34 UTC

This package is not auto-updated.

Last update: 2024-09-29 02:54:57 UTC


README

composer require socialiteproviders/apple

安装与基本使用

请参阅基本安装指南,然后遵循以下特定提供者的说明。

config/services.php 添加配置

'apple' => [
  'client_id' => env('APPLE_CLIENT_ID'),
  'client_secret' => env('APPLE_CLIENT_SECRET'),
  'redirect' => env('APPLE_REDIRECT_URI')
],

参阅配置 Apple ID 验证

添加提供者事件监听器

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

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

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

使用方法

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

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

返回的用户字段

  • id
  • name
  • email

参考