dmt-software/oauth2-trustpilot 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

dmt-software/oauth2-trustpilot

最新稳定版本:v1.0.1

Composer 安装命令:

composer require dmt-software/oauth2-trustpilot

包简介

A Trustpilot Client Provider for The PHP League OAuth2-Client

README 文档

README

Install

composer require dmt-software/oauth2-trustpilot

Usage

use DMT\OAuth2\Client\Provider\Trustpilot;
use League\OAuth2\Client\Provider\Exception\IdentityProviderException;

$provider = new Trustpilot([
    'clientId' => '{ your_client_id }',
    'clientSecret' => '{ your_client_secret }',
]);

try {
    $accessToken = $provider->getAccessToken(
        'password', [
            'username' => '{ your_username }',
            'password' => '{ your_password }'
        ]
    );
} catch (IdentityProviderException $exception) {
    if ($exception->getCode() === 401) {
        // token is expired
    }
    if ($exception->getCode() === 429) {
        // too many requests
    }
}

see more examples on league/oauth2-client

Error handling

Unfortunately the response body in case of an error is not consistent. To better understand the reason a request is failed call the IdentityProviderException::getResponseBody method.

统计信息

  • 总下载量: 15.91k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-04-12