minawilliam/apple-socialite-provider

此包已被废弃且不再维护。未建议替代包。

Laravel Socialite 的 Apple OAuth2 提供器

5.0.1 2021-01-07 02:09 UTC

This package is not auto-updated.

Last update: 2022-08-19 00:59:15 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 一样使用此提供器(假设您已安装了 facade)

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

返回的用户字段

  • id
  • name
  • email

参考