yeaggercom / socialiteprovider-apple
Laravel Socialite 的 Apple OAuth2 提供者
5.0.2
2021-03-25 22:34 UTC
Requires
- php: ^7.4 || ^8.0
- ext-json: *
- ext-openssl: *
- firebase/php-jwt: ^5.2
- lcobucci/jwt: ^4.0
- socialiteproviders/manager: ~4.0
Suggests
- ahilmurugesan/socialite-apple-helper: Automatic Apple client key generation and management.
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') ],
添加提供者事件监听器
配置该包的监听器以监听 SocialiteWasCalled 事件。
将事件添加到您的 app/Providers/EventServiceProvider 中的 listen[] 数组。有关详细说明,请参阅基本安装指南。
protected $listen = [ \SocialiteProviders\Manager\SocialiteWasCalled::class => [ // ... other providers 'SocialiteProviders\\Apple\\AppleExtendSocialite@handle', ], ];
使用方法
现在您应该能够像通常使用 Socialite 一样使用此提供者(假设您已安装了外观)
return Socialite::driver('apple')->redirect();
返回的用户字段
idnameemail