{"id":17031668,"url":"https://github.com/alaasarhan/oauth2-docusign","last_synced_at":"2025-04-12T12:52:31.176Z","repository":{"id":53454618,"uuid":"156135969","full_name":"AlaaSarhan/oauth2-docusign","owner":"AlaaSarhan","description":"Docusign OAuth2 Provider for League OAuth2 Client","archived":false,"fork":false,"pushed_at":"2024-03-30T16:07:17.000Z","size":33,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-10T09:09:38.970Z","etag":null,"topics":["docusign","docusign-oauth","league-oauth2","oauth","oauth2","oauth2-client","php"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AlaaSarhan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2018-11-04T23:40:11.000Z","updated_at":"2023-12-02T13:11:51.000Z","dependencies_parsed_at":"2024-03-30T17:25:01.592Z","dependency_job_id":null,"html_url":"https://github.com/AlaaSarhan/oauth2-docusign","commit_stats":{"total_commits":27,"total_committers":2,"mean_commits":13.5,"dds":0.2592592592592593,"last_synced_commit":"f70ec95c67a370c590af50ba6ae6fd9a29404b66"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlaaSarhan%2Foauth2-docusign","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlaaSarhan%2Foauth2-docusign/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlaaSarhan%2Foauth2-docusign/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlaaSarhan%2Foauth2-docusign/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlaaSarhan","download_url":"https://codeload.github.com/AlaaSarhan/oauth2-docusign/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248571608,"owners_count":21126520,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docusign","docusign-oauth","league-oauth2","oauth","oauth2","oauth2-client","php"],"created_at":"2024-10-14T08:25:03.559Z","updated_at":"2025-04-12T12:52:31.157Z","avatar_url":"https://github.com/AlaaSarhan.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Docusign Provider for OAuth 2.0 Client\n\n[![Latest Version](https://img.shields.io/github/release/AlaaSarhan/oauth2-docusign.svg?style=flat-square)](https://github.com/AlaaSarhan/oauth2-docusign/releases)\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)\n[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/AlaaSarhan/oauth2-docusign.svg?style=flat-square)](https://scrutinizer-ci.com/g/AlaaSarhan/oauth2-docusign/code-structure)\n[![Quality Score](https://img.shields.io/scrutinizer/g/AlaaSarhan/oauth2-docusign.svg?style=flat-square)](https://scrutinizer-ci.com/g/AlaaSarhan/oauth2-docusign)\n[![Total Downloads](https://img.shields.io/packagist/dt/sarhan/oauth2-docusign.svg?style=flat-square)](https://packagist.org/packages/sarhan/oauth2-docusign)\n\nThis package provides Docusign OAuth 2.0 support for the PHP League's [OAuth 2.0 Client](https://github.com/thephpleague/oauth2-client).\n\n## Installation\n\nTo install, use composer:\n\n```\ncomposer require sarhan/oauth2-docusign\n```\n\n## Usage\n\nUsage is the same as The League's OAuth client, using `\\Sarhan\\OAuth2\\Client\\Provider\\Docusign` as the provider.\n\n### Authorization Code Flow\n\n```php\n$provider = new \\Sarhan\\OAuth2\\Client\\Provider\\Docusign([\n    'clientId'          =\u003e '{docusign-integrator-key}',\n    'clientSecret'      =\u003e '{docusign-integrator-key-secret}',\n    'redirectUri'       =\u003e 'https://example.com/callback-url'\n]);\n\nif (!isset($_GET['code'])) {\n\n    // If we don't have an authorization code then get one\n    $authUrl = $provider-\u003egetAuthorizationUrl();\n    $_SESSION['oauth2state'] = $provider-\u003egetState();\n    header('Location: ' . $authUrl);\n    exit;\n\n// Check given state against previously stored one to mitigate CSRF attack\n} elseif (empty($_GET['state']) || ($_GET['state'] !== $_SESSION['oauth2state'])) {\n\n    unset($_SESSION['oauth2state']);\n    exit('Invalid state');\n\n} else {\n\n    // Try to get an access token (using the authorization code grant)\n    $token = $provider-\u003egetAccessToken('authorization_code', [\n        'code' =\u003e $_GET['code']\n    ]);\n\n    // Optional: Now you have a token you can look up a users profile data\n    try {\n\n        // We got an access token, let's now get the user's details\n        $user = $provider-\u003egetResourceOwner($token);\n\n        // Use these details to create a new profile\n        printf('Hello %s!', $user-\u003egetId());\n\n    } catch (Exception $e) {\n\n        // Failed to get user details\n        exit('Oh dear...');\n    }\n\n    // Use this to interact with an API on the users behalf\n    echo $token-\u003egetToken();\n}\n```\n\n### Refreshing a Token\n\n```php\n$provider = new \\Sarhan\\OAuth2\\Client\\Provider\\Docusign([\n    'clientId'          =\u003e '{docusign-integrator-key}',\n    'clientSecret'      =\u003e '{docusign-integrator-key-secret}',\n    'redirectUri'       =\u003e 'https://example.com/callback-url'\n]);\n\n$token = $provider-\u003egetAccessToken('refresh_token', [\n\t'refresh_token' =\u003e '{refresh token}'\n]);\n```\n\n## Vendor specific options\n\n`sandbox`\n\nwhen passed with `true` to the provider constructor, the provider will direct docuaign endpoint calls to docusign sandbox domain (account-d.docusign.com).\n\n```php\n$provider = new \\Sarhan\\OAuth2\\Client\\Provider\\Docusign([\n    'clientId'          =\u003e '{docusign-integrator-key}',\n    'clientSecret'      =\u003e '{docusign-integrator-key-secret}',\n    'redirectUri'       =\u003e 'https://example.com/callback-url',\n    'sandbox'           =\u003e true\n]);\n```\n\n\n## Testing\n\n```bash\n$ ./vendor/bin/phpunit\n```\n\nor\n\n```bash\n$ composer test\n```\n\n## Contributing\n\nPlease see [CONTRIBUTING](https://github.com/AlaaSarhan/oauth2-docusign/blob/master/CONTRIBUTING.md) for details.\n\n\n## License\n\nThe MIT License (MIT). Please see [License File](https://github.com/AlaaSarhan/oauth2-docusign/blob/master/LICENSE) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falaasarhan%2Foauth2-docusign","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falaasarhan%2Foauth2-docusign","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falaasarhan%2Foauth2-docusign/lists"}