claromentis / opauth-google
Opauth 的 Google 认证策略
1.0.0
2015-12-29 10:36 UTC
Requires
- php: >=5.3.0
- claromentis/opauth: ^1.0
Replaces
- opauth/google: 1.x
This package is auto-updated.
Last update: 2024-08-28 03:52:53 UTC
README
Opauth 的 Google 认证策略。
基于 https://developers.google.com/accounts/docs/OAuth2 使用 OAuth 2.0 实现。
Opauth 是 PHP 的多提供者认证框架。
入门指南
-
安装 Opauth-Google
cd path/to/app/root composer require claromentis/opauth-google:1.x
-
在 https://code.google.com/apis/console/ 创建 Google APIs 项目
- 不需要在“服务”标签页启用任何服务。
- 确保前往“API 访问”标签页并创建一个 OAuth 2.0 客户端 ID。
- 选择 Web 应用 作为 应用程序类型
- 确保重定向 URI 设置为实际的 OAuth 2.0 回调 URL,通常是
http://path_to_opauth/google/callback
-
配置 Opauth-Google 策略。
-
将用户直接导向
http://path_to_opauth/google
进行认证
策略配置
必需参数
<?php 'Google' => array( 'client_id' => 'YOUR CLIENT ID', 'client_secret' => 'YOUR CLIENT SECRET' )
可选参数: scope
、state
、access_type
、approval_prompt
参考
许可
Opauth-Google 是 MIT 许可版权 © 2012 U-Zyn Chua (http://uzyn.com)