{"id":15063310,"url":"https://github.com/gregurco/guzzlebundleoauth2plugin","last_synced_at":"2025-08-27T15:06:53.076Z","repository":{"id":45033859,"uuid":"107998226","full_name":"gregurco/GuzzleBundleOAuth2Plugin","owner":"gregurco","description":"OAuth2 Plugin for GuzzleBundle","archived":false,"fork":false,"pushed_at":"2024-04-07T14:52:32.000Z","size":60,"stargazers_count":13,"open_issues_count":4,"forks_count":14,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-10T11:03:11.103Z","etag":null,"topics":["bundle","guzzle","oauth2","oauth2-middleware","php","symfony","symfony-bundle"],"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/gregurco.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,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2017-10-23T15:03:29.000Z","updated_at":"2025-01-21T16:25:56.000Z","dependencies_parsed_at":"2024-04-07T15:23:07.056Z","dependency_job_id":"413bc3bb-08a7-4070-8561-199530f7279f","html_url":"https://github.com/gregurco/GuzzleBundleOAuth2Plugin","commit_stats":{"total_commits":42,"total_committers":6,"mean_commits":7.0,"dds":0.2142857142857143,"last_synced_commit":"f59f00a5153e5e991948e66968ec8ebc678dee72"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/gregurco/GuzzleBundleOAuth2Plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregurco%2FGuzzleBundleOAuth2Plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregurco%2FGuzzleBundleOAuth2Plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregurco%2FGuzzleBundleOAuth2Plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregurco%2FGuzzleBundleOAuth2Plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gregurco","download_url":"https://codeload.github.com/gregurco/GuzzleBundleOAuth2Plugin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregurco%2FGuzzleBundleOAuth2Plugin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272342583,"owners_count":24917651,"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","status":"online","status_checked_at":"2025-08-27T02:00:09.397Z","response_time":76,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["bundle","guzzle","oauth2","oauth2-middleware","php","symfony","symfony-bundle"],"created_at":"2024-09-24T23:54:49.795Z","updated_at":"2025-08-27T15:06:53.025Z","avatar_url":"https://github.com/gregurco.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Guzzle Bundle OAuth2 Plugin\n\n[![Build Status](https://travis-ci.org/gregurco/GuzzleBundleOAuth2Plugin.svg?branch=master)](https://travis-ci.org/gregurco/GuzzleBundleOAuth2Plugin)\n[![Coverage Status](https://coveralls.io/repos/gregurco/GuzzleBundleOAuth2Plugin/badge.svg?branch=master)](https://coveralls.io/r/gregurco/GuzzleBundleOAuth2Plugin)\n[![SensioLabsInsight](https://insight.sensiolabs.com/projects/eba4f2e6-2c2a-4e92-85b6-c32ab3ac3aa7/mini.png)](https://insight.sensiolabs.com/projects/eba4f2e6-2c2a-4e92-85b6-c32ab3ac3aa7)\n\nThis plugin integrates [OAuth2][1] functionality into [Guzzle Bundle][2], a bundle for building RESTful web service clients.\n\n----\n\n## Prerequisites\n - PHP 7.2 or above\n - [Guzzle Bundle][2]\n - [guzzle-oauth2-plugin][3]\n\n## Installation\n\nTo install this bundle, run the command below on the command line and you will get the latest stable version from [Packagist][4].\n\n``` bash\ncomposer require gregurco/guzzle-bundle-oauth2-plugin\n```\n\n## Usage\n\n### Enable bundle\n\nFind next lines in `src/Kernel.php`:\n\n```php\nforeach ($contents as $class =\u003e $envs) {\n    if (isset($envs['all']) || isset($envs[$this-\u003eenvironment])) {\n        yield new $class();\n    }\n}\n```\n\nand replace them by:\n\n```php\nforeach ($contents as $class =\u003e $envs) {\n    if (isset($envs['all']) || isset($envs[$this-\u003eenvironment])) {\n        if ($class === \\EightPoints\\Bundle\\GuzzleBundle\\EightPointsGuzzleBundle::class) {\n            yield new $class([\n                new \\Gregurco\\Bundle\\GuzzleBundleOAuth2Plugin\\GuzzleBundleOAuth2Plugin(),\n            ]);\n        } else {\n            yield new $class();\n        }\n    }\n}\n```\n\n### Basic configuration\n\n#### With default grant type (client)\n\n``` yaml\n# app/config/config.yml\n\neight_points_guzzle:\n    clients:\n        api_payment:\n            base_url: \"http://api.domain.tld\"\n            \n            options:\n                auth: oauth2\n\n            # plugin settings\n            plugin:\n                oauth2:\n                    base_uri:       \"https://example.com\"\n                    token_url:      \"/oauth/token\"\n                    client_id:      \"test-client-id\"\n                    client_secret:  \"test-client-secret\" # optional\n                    scope:          \"administration\"\n```\n\n#### With password grant type\n\n``` yaml\n# app/config/config.yml\n\neight_points_guzzle:\n    clients:\n        api_payment:\n            base_url: \"http://api.domain.tld\"\n            \n            options:\n                auth: oauth2\n\n            # plugin settings\n            plugin:\n                oauth2:\n                    base_uri:       \"https://example.com\"\n                    token_url:      \"/oauth/token\"\n                    client_id:      \"test-client-id\"\n                    username:       \"johndoe\"\n                    password:       \"A3ddj3w\"\n                    scope:          \"administration\"\n                    grant_type:     \"Sainsburys\\\\Guzzle\\\\Oauth2\\\\GrantType\\\\PasswordCredentials\"\n```\n\n#### With client credentials in body\n\n``` yaml\n# app/config/config.yml\n\neight_points_guzzle:\n    clients:\n        api_payment:\n            base_url: \"http://api.domain.tld\"\n            \n            options:\n                auth: oauth2\n\n            # plugin settings\n            plugin:\n                oauth2:\n                    base_uri:       \"https://example.com\"\n                    token_url:      \"/oauth/token\"\n                    client_id:      \"test-client-id\"\n                    scope:          \"administration\"\n                    auth_location:  \"body\"\n```\n\n### Options\n\n| Key | Description | Required | Example |\n| --- | --- | --- | --- |\n| base_uri | URL of oAuth2 server.| yes | https://example.com |\n| token_url | The path that will be concatenated with base_uri. \u003cbr/\u003eDefault: `/oauth2/token`| no | /oauth/token |\n| client_id | The client identifier issued to the client during the registration process | yes | s6BhdRkqt3 |\n| client_secret | The client secret | no | 7Fjfp0ZBr1KtDRbnfVdmIw |\n| username | The resource owner username | for PasswordCredentials grant type | johndoe |\n| password | The resource owner password | for PasswordCredentials grant type | A3ddj3w |\n| auth_location | The place where to put client_id and client_secret in auth request. \u003cbr/\u003eDefault: headers. Allowed values: body, headers. | no | body |\n| resource | The App ID URI of the web API (secured resource) | no | https://service.contoso.com/ |\n| private_key | Path to private key | for JwtBearer grant type | `\"%kernel.root_dir%/path/to/private.key\"` |\n| scope | One or more scope values indicating which parts of the user's account you wish to access | no | administration |\n| audience | | no | |\n| grant_type | Grant type class path. Class should implement GrantTypeInterface. \u003cbr/\u003e Default: `Sainsburys\\\\Guzzle\\\\Oauth2\\\\GrantType\\\\ClientCredentials` | no | `Sainsburys\\\\Guzzle\\\\Oauth2\\\\GrantType\\\\PasswordCredentials`\u003cbr/\u003e`Sainsburys\\\\Guzzle\\\\Oauth2\\\\GrantType\\\\AuthorizationCode`\u003cbr/\u003e`Sainsburys\\\\Guzzle\\\\Oauth2\\\\GrantType\\\\JwtBearer` |\n| persistent | Token will be stored in session unless grant_type is client credentials; in which case it will be stored in the app cache. \u003cbr/\u003e Default: false | no | |\n| retry_limit | How many times request will be repeated on failure. \u003cbr/\u003e Default: 5 | no | |\n\nSee more information about middleware [here][3].\n\n## License\n\nThis middleware is licensed under the MIT License - see the LICENSE file for details\n\n[1]: http://www.xml.com/pub/a/2003/12/17/dive.html\n[2]: https://github.com/8p/EightPointsGuzzleBundle\n[3]: https://github.com/Sainsburys/guzzle-oauth2-plugin\n[4]: https://packagist.org/packages/gregurco/guzzle-bundle-oauth2-plugin\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregurco%2Fguzzlebundleoauth2plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgregurco%2Fguzzlebundleoauth2plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregurco%2Fguzzlebundleoauth2plugin/lists"}