pimplesushant/laravelsocialiteapi
Composer 安装命令:
composer require pimplesushant/laravelsocialiteapi
包简介
Social Login for Laravel API
README 文档
README
A powerful package designed to implement social signup and signin using access_token in Laravel. This package takes care of Facebook and Google+ social signup and signin as of now. We'll be adding more services soon.
Installation
This package is availabe on composer.
composer require pimplesushant/laravelsocialiteapi
Alternatively you can edit your composer.json and add
"pimplesushant/laravelsocialiteapi": "^1.0"
and composer update
Usage
To use this package you'll need to follow required steps of Laravel Passport. You can make following changes in files as follows :
1. /.env
DB_DATABASE=
DB_USERNAME=
DB_PASSWORD=
FACEBOOK_CLIENT_ID=
FACEBOOK_CLIENT_SECRET=
FACEBOOK_CLIENT_REDIRECT=
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
GOOGLE_CLIENT_REDIRECT=
GOOGLE_DEVELOPER_KEY=
Then,
php artisan migrate
and
php artisan passport:install
2. /app/User.php
use Laravel\Passport\HasApiTokens;
use HasApiTokens;
and
public function social_accounts()
{
return $this->hasMany(\Pimplesushant\Laravelsocialiteapi\SocialAccount::class)->with('social_accounts');
}
3. /app/Providers/AuthServicePorvider.php
use Laravel\Passport\Passport;
and
Passport::routes(); //in boot()
4. /config/auth.php
'api' => [
'driver' => 'passport',
'provider' => 'users',
],
5. /config/services.php
'facebook' => [
'client_id' => env('FACEBOOK_CLIENT_ID'),
'client_secret' => env('FACEBOOK_CLIENT_SECRET'),
'redirect' => env('FACEBOOK_CLIENT_REDIRECT')
],
'google' => [
'client_id' => env('GOOGLE_CLIENT_ID'),
'client_secret' => env('GOOGLE_CLIENT_SECRET'),
'redirect' => env('GOOGLE_CLIENT_REDIRECT')
]
Now you can serve the application and hit the route /social-login with provider (e.g. facebook, google) and access_token (Access token retrieved from social service providers)
License
Licensed under the MIT License
Author
Pimple Suhsant (https://pimplesushant.in)
pimplesushant/laravelsocialiteapi 适用场景与选型建议
pimplesushant/laravelsocialiteapi 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 157 次下载、GitHub Stars 达 13, 最近一次更新时间为 2018 年 06 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 pimplesushant/laravelsocialiteapi 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 pimplesushant/laravelsocialiteapi 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 157
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 13
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2018-06-21