{"id":36428331,"url":"https://github.com/wheniwork/oauth2-vend","last_synced_at":"2026-01-11T18:26:17.114Z","repository":{"id":32798497,"uuid":"36390883","full_name":"wheniwork/oauth2-vend","owner":"wheniwork","description":"Vend provider for the OAuth 2.0 Client","archived":false,"fork":false,"pushed_at":"2015-05-27T22:10:59.000Z","size":132,"stargazers_count":3,"open_issues_count":2,"forks_count":2,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-08-05T13:11:26.829Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"containerd/containerd","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wheniwork.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-27T19:34:59.000Z","updated_at":"2024-12-12T22:27:51.000Z","dependencies_parsed_at":"2022-08-24T14:23:17.626Z","dependency_job_id":null,"html_url":"https://github.com/wheniwork/oauth2-vend","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/wheniwork/oauth2-vend","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wheniwork%2Foauth2-vend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wheniwork%2Foauth2-vend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wheniwork%2Foauth2-vend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wheniwork%2Foauth2-vend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wheniwork","download_url":"https://codeload.github.com/wheniwork/oauth2-vend/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wheniwork%2Foauth2-vend/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28317703,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-11T14:58:17.114Z","status":"ssl_error","status_checked_at":"2026-01-11T14:55:53.580Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2026-01-11T18:26:16.451Z","updated_at":"2026-01-11T18:26:17.103Z","avatar_url":"https://github.com/wheniwork.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Vend Provider for OAuth 2.0 Client\n\n[![Build Status](https://img.shields.io/travis/wheniwork/oauth2-vend.svg)](https://travis-ci.org/wheniwork/oauth2-vend)\n[![Code Coverage](https://img.shields.io/coveralls/wheniwork/oauth2-vend.svg)](https://coveralls.io/r/wheniwork/oauth2-vend)\n[![Code Quality](https://img.shields.io/scrutinizer/g/wheniwork/oauth2-vend.svg)](https://scrutinizer-ci.com/g/wheniwork/oauth2-vend/)\n[![License](https://img.shields.io/packagist/l/wheniwork/oauth2-vend.svg)](https://github.com/wheniwork/oauth2-vend/blob/master/LICENSE)\n[![Latest Stable Version](https://img.shields.io/packagist/v/wheniwork/oauth2-vend.svg)](https://packagist.org/packages/wheniwork/oauth2-vend)\n\nThis package provides [Vend OAuth 2.0](https://developers.vendhq.com/documentation/oauth.html) 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 wheniwork/oauth2-vend\n```\n\n## Usage\n\nUsage is the same as The League's OAuth client, using `Wheniwork\\OAuth2\\Client\\Provider\\Vend` as the provider.\n\n### Authorization Code Flow\n\n```php\n$provider = new Wheniwork\\OAuth2\\Client\\Provider\\Vend([\n    'clientId'     =\u003e '{vend-client-id}',\n    'clientSecret' =\u003e '{vend-client-secret}',\n    'domainPrefix' =\u003e '{vend-domain-prefix}',\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-\u003estate;\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    // Vend does not provide a way to get information about the currently\n    // authenticated user. (If you know of a way, please let me know!)\n\n    // Use this to interact with an API on the users behalf\n    echo $token-\u003eaccessToken;\n}\n```\n\n## Refreshing a Token\n\n```php\n$provider = new Wheniwork\\OAuth2\\Client\\Provider\\Vend([\n    'clientId'     =\u003e '{vend-client-id}',\n    'clientSecret' =\u003e '{vend-client-secret}',\n    'domainPrefix' =\u003e '{vend-domain-prefix}',\n    'redirectUri'  =\u003e 'https://example.com/callback-url'\n]);\n\n$grant = new \\League\\OAuth2\\Client\\Grant\\RefreshToken();\n$token = $provider-\u003egetAccessToken($grant, ['refresh_token' =\u003e $refreshToken]);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwheniwork%2Foauth2-vend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwheniwork%2Foauth2-vend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwheniwork%2Foauth2-vend/lists"}