承接 olsgreen/oauth2-adobe-sign 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

olsgreen/oauth2-adobe-sign

最新稳定版本:1.0.1

Composer 安装命令:

composer require olsgreen/oauth2-adobe-sign

包简介

Adobe Sign OAuth 2.0 Client Provider for The PHP League OAuth2-Client

README 文档

README

Latest Version Tests Software License

This package provides Adobe Sign OAuth 2.0 support for the PHP League's OAuth 2.0 Client.

Looking for an AdobeSign API client? See olsgreen/adobe-sign-api.

This package requires PHP >= 7.3.

Installation

To install, use composer:

composer require olsgreen/oauth2-adobe-sign

Usage

Usage is the same as The League's OAuth client, using \Olsgreen\OAuth2\Client\Provider\AdobeSign as the provider.

Authorization Code Flow

$provider = new Olsgreen\OAuth2\Client\Provider\AdobeSign([
    'clientId'          => '{adobe-client-id}',
    'clientSecret'      => '{adobe-client-secret}',
    'redirectUri'       => 'https://example.com/callback-url',
    'dataCenter'        => 'eu2'
]);

if (!isset($_GET['code'])) {

    $authorizationOptions = [
        // See documentation relating to scopes:
        // https://opensource.adobe.com/acrobat-sign/developer_guide/helloworld.html#configure-scopes
        'scope' => [
            'agreement_read',
            'agreement_write',
            'agreement_send',
            'webhook_read',
            'webhook_write',
            'webhook_retention'
        ]
    ];

    // If we don't have an authorization code then get one
    $authUrl = $provider->getAuthorizationUrl($authorizationOptions);
    $_SESSION['oauth2state'] = $provider->getState();
    header('Location: '.$authUrl);
    exit;

// Check given state against previously stored one to mitigate CSRF attack
} elseif (empty($_GET['state']) || ($_GET['state'] !== $_SESSION['oauth2state'])) {

    unset($_SESSION['oauth2state']);
    exit('Invalid state');

} else {

    // Try to get an access token (using the authorization code grant)
    $token = $provider->getAccessToken('authorization_code', [
        'code' => $_GET['code']
    ]);

    // Use this to interact with an API on the users behalf
    echo $token->getToken();
}

Data Centers

The data center should match that of the account you are trying to access, so best store the datacenter with the access token. The current datacenters are:

  • na1 = North America 1
  • na2 = North America 2
  • eu1 = EU 1
  • eu2 = EU 2
  • au1 = Australia 1
  • jp1 = Japan 1

Provider Quirks

Adobe do not provide an endpoint to retrieve the current user, so getResourceOwnerDetailsUrl(), createResourceOwner() & getResourceOwner() will throw NotImplmenetedException.

Testing

$ ./vendor/bin/phpunit

Credits

Originally forked from kevinm/oauth2-adobe-sign.

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-01-29