graze / gigya-client
针对 Gigya API 的 REST 客户端
2.0.2
2020-05-07 12:14 UTC
Requires
- php: ^5.5|^7.0
- guzzlehttp/guzzle: ^6.2
- illuminate/support: ^5.0|^6.0|^7.0
Requires (Dev)
- graze/standards: ^2.0
- mockery/mockery: ^0.9.4
- phpunit/phpunit: ^4.8.36 | ^5.2
- sebastian/comparator: ^1.2.4
- squizlabs/php_codesniffer: ^3
This package is auto-updated.
Last update: 2024-09-19 21:49:36 UTC
README
针对 Gigya REST API 的客户端
- 端点调用层次结构:
$gigya->accounts()->tfa()->getCertificate()
- 端点列表:
accounts
、accounts->tfa
、audit
、socialize
、comments
、gameMechanics
、reports
、dataStore
、identityStorage
、saml
、saml->idp
- 填充类并提供自动完成辅助工具,用于 Gigya 可用方法
- 不同的认证方法
gigya
:向 https 请求中添加api_key
和secret
credentials
:使用client_id
和client_secret
用于与 oauth2 令牌检索一起使用gigya-oauth2
:使用自动检索的 OAuth2 令牌custom
:使用您自己的自定义认证(或使用带有提供令牌的 oauth2)
安装
安装客户端最简单的方法是使用 composer 并运行
$ composer require graze/gigya-client
用法
默认情况下,Gigya 客户端使用 gigya
认证,并在通过 https 调用 Gigya 时将 api_key 和 secret 添加到查询字符串中。
$gigya = new Gigya($key, $secret); $response = $gigya->accounts()->getAccountInfo(['uid' => $uid]); if ($response->getErrorCode() === ErrorCode::OK) { $account = $response->getData(); }
OAuth 2
您还可以在服务器模式下使用 oauth2
并检索有关所有账户的信息
$gigya = new Gigya($key, $secret, $region, $user, ['auth'=>'gigya-oauth2']); $response = $gigya->accounts()->getAccountInfo(['uid' => $uid]); $account = $response->getData();
社交 OAuth 2
OAuth2 还可以用于检索有关单个账户的信息,而无需知道 uid
。
$grant = new ManualGrant(); $gigya = new Gigya($key, $secret, $region, null, ['auth' => 'oauth2-custom']); $gigya->addHandler(OAuth2Subscriber::middleware($grant, 'oauth2-custom')); $tokenResponse = $gigya->socialize()->getToken([ 'grant_type' => 'code', 'authorization_code' => '<xxxxx>', 'redirect_uri' => '<xxxxx>', ], ['auth' => 'credentials']); $grant->setToken($tokenResponse->getData()->get('access_token')); $response = $gigya->accounts()->getAccountInfo(); $account = $response->getData();
变更日志
有关最近更改的更多信息,请参阅 CHANGELOG。
测试
$ make install
$ make test
贡献
有关详细信息,请参阅 CONTRIBUTING。
安全
如果您发现任何安全问题,请通过电子邮件 security@graze.com 联系我们,而不是使用问题跟踪器。
致谢
许可证
MIT 许可证 (MIT)。有关更多信息,请参阅 许可证文件。