unikapps/laravel-socialite-squarespace

Squarespace 的 Laravel socialite 提供者

dev-main 2023-08-16 04:57 UTC

This package is auto-updated.

Last update: 2024-09-16 07:18:23 UTC


README

composer require unikapps/laravel-socialite-squarespace

安装与基本使用

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

config/services.php 中添加配置

'squarespace' => [    
  'client_id' => env('SQUARESPACE_CLIENT_ID'),  
  'client_secret' => env('SQUARESPACE_CLIENT_SECRET'),  
  'redirect' => env('SQUARESPACE_REDIRECT_URI') 
],

添加提供者事件监听器

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

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

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

使用方法

现在你应该能够像通常使用 Socialite 一样使用提供者(假设你已经安装了 facade)

$scopes = ['website.products.read', 'website.profiles.read'];
return Socialite::driver('squarespace')->scopes($scopes)->redirect();

返回的用户字段

  • id 作为 Squarespace 实例 ID
  • name 作为网站显示名称
  • email 目前无法访问账户电子邮件,我们通过返回:{子域}@squarespace.com 来模拟