upwebdesign/infusionsoft-socialite
Composer 安装命令:
composer require upwebdesign/infusionsoft-socialite
包简介
Infusionsoft OAuth2 Provider for Laravel Socialite
README 文档
README
Installation & Basic Usage
composer require upwebdesign/infusionsoft-socialite
Add configuration to config/services.php
'infusionsoft' => [ 'client_id' => env('INFUSIONSOFT_CLIENT_ID'), 'client_secret' => env('INFUSIONSOFT_CLIENT_SECRET'), 'redirect' => env('INFUSIONSOFT_REDIRECT_URI', '/auth/infusionsoft/callback'), 'auth' => env('INFUSIONSOFT_AUTH_URI', '/auth/infusionsoft/redirect'), ],
The redirect URI is a local URL that will generate the necessary information to send to Infusionsoft to connect via OAuth. The callback URI is where the user will be returned after successfully authenticated.
Update your .env
Of course redirect and callback are both optional.
INFUSIONSOFT_CLIENT_ID= INFUSIONSOFT_CLIENT_SECRET= INFUSIONSOFT_REDIRECT_URI= INFUSIONSOFT_CALLBACK_URI=
Events
After the user has been authenticated, the InfusionsoftSoclialiteAuthenticated event will fire. You can listen for this event to create your new user in your account. Be sure to import the InfusionsoftSoclialiteAuthenticated class.
protected $listen = [ Registered::class => [SendEmailVerificationNotification::class], InfusionsoftSocialiteAuthenticated::class =>[ // Place your listener here... ] ];
This event will return a Socialite User object with the following keys. Id and nickname will always be null because Infusionsoft does not use these fields with OAuth.
Laravel\Socialite\Two\User {#319 ▼
+token: "********"
+refreshToken: "********"
+expiresIn: 86399
+approvedScopes: array:1 [▶]
+id: null
+nickname: null
+name: "Jane Doe"
+email: "jane@example.com"
+avatar: "https://cdn.com/avatar.jpg"
+user: array:14 [▼
"name" => "Jane Doe"
"email" => "jane@example.com"
"website" => "https://google.com/"
"phone" => null
"address" => array:9 [▶]
"phone_ext" => null
"time_zone" => "America/New_York"
"logo_url" => "https://cdn.com/avatar.jpg"
"currency_code" => "USD"
"language_tag" => "en-US"
"business_type" => null
"business_goals" => []
"business_primary_color" => null
"business_secondary_color" => null
]
}
Alt usage
You may also use the provider like you would regularly use Socialite (assuming you have the facade installed):
To start the OAuth flow, call the redirect method to request an authorization code.
return Socialite::driver('infusionsoft')->redirect();
Retrieve the token using the authorization code to do with what you will.
$token = Socialite::driver('infusionsoft')->getToken();
Get account data for the Infusionsoft connection.
$user return Socialite::driver('infusionsoft')->user();
upwebdesign/infusionsoft-socialite 适用场景与选型建议
upwebdesign/infusionsoft-socialite 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 01 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 upwebdesign/infusionsoft-socialite 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 upwebdesign/infusionsoft-socialite 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 4
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-01-07