waglpz/google-sso
Composer 安装命令:
composer require waglpz/google-sso
包简介
Single sign on with Google. Minimal implementation.
README 文档
README
The Google SSO Client Library enables you to work with single sign on via Google API.
Requirements
PHP 8.2 or higher
Installation
composer require waglpz/google-sso:"^1.0"
Authentication with OAuth
- Follow the instructions to Create Web Application Credentials
- Download the JSON credentials in some hidden directory and include this one path in config.
- Set the path to these credentials using config
authConfig. - Set the scopes required for the API you are going to call using config key
scopes - Set your application's redirect URI in config
- Set expected prompt when redirect to google. These can
none,consentorselect_account. - In the script handling the redirect URI, exchange the authorization code for an access token:
Example
$config = include __DIR__ . '/../config/sso.php'; $googleSSO = new \GoogleSSO\GoogleSSO($config); $authorizationCodeUrl = $googleSSO->createAuthUrl(); // Go to the $authorizationCodeUrl and select account you will authenticate against. // these will redirect you to defined/known redirect URI and a PHP script will use the code which sends back from Google. $accountData = $googleSSO->fetchAccountDataUsingAuthorizationCode($_GET['code']); // $accountData contains necessary information if one was founded by google
Code Quality and Testing
To check for coding style violations, run
composer waglpz:code:style:check
To automatically fix (fixable) coding style violations, run
composer waglpz:code:style:fix
To check for static type violations, run
waglpz:code:analyse
To check for regressions, run
composer waglpz:test:norma
To check all violations at once, run
composer waglpz:check:normal
waglpz/google-sso 适用场景与选型建议
waglpz/google-sso 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.8k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2020 年 09 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 waglpz/google-sso 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 waglpz/google-sso 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 3.8k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-09-25