{"id":41594414,"url":"https://github.com/trikoder/oauth2-bundle","last_synced_at":"2026-01-24T09:37:03.026Z","repository":{"id":33544443,"uuid":"159322910","full_name":"trikoder/oauth2-bundle","owner":"trikoder","description":"Symfony bundle which provides OAuth 2.0 authorization/resource server capabilities.","archived":false,"fork":false,"pushed_at":"2023-10-07T10:16:38.000Z","size":725,"stargazers_count":250,"open_issues_count":63,"forks_count":114,"subscribers_count":19,"default_branch":"v3.x","last_synced_at":"2025-03-19T19:48:09.163Z","etag":null,"topics":["bundle","oauth2","php","symfony"],"latest_commit_sha":null,"homepage":"https://www.trikoder.net/","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/trikoder.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"Security/Authentication/Provider/OAuth2Provider.php","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-27T11:11:27.000Z","updated_at":"2024-11-30T09:08:34.000Z","dependencies_parsed_at":"2024-06-18T12:24:24.157Z","dependency_job_id":"4edd58e7-e56d-478a-9add-ec14084e11e6","html_url":"https://github.com/trikoder/oauth2-bundle","commit_stats":{"total_commits":360,"total_committers":26,"mean_commits":"13.846153846153847","dds":0.8083333333333333,"last_synced_commit":"bbfaada32a1af84a5150df7bbbadab2603cb5db6"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/trikoder/oauth2-bundle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trikoder%2Foauth2-bundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trikoder%2Foauth2-bundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trikoder%2Foauth2-bundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trikoder%2Foauth2-bundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trikoder","download_url":"https://codeload.github.com/trikoder/oauth2-bundle/tar.gz/refs/heads/v3.x","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trikoder%2Foauth2-bundle/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28723518,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-24T08:27:05.734Z","status":"ssl_error","status_checked_at":"2026-01-24T08:27:01.197Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["bundle","oauth2","php","symfony"],"created_at":"2026-01-24T09:37:02.969Z","updated_at":"2026-01-24T09:37:03.018Z","avatar_url":"https://github.com/trikoder.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Trikoder OAuth 2 Bundle\n\n[![Build Status](https://github.com/trikoder/oauth2-bundle/workflows/Tests/badge.svg?branch=v3.x)](https://github.com/trikoder/oauth2-bundle/actions)\n[![Latest Stable Version](https://poser.pugx.org/trikoder/oauth2-bundle/v/stable)](https://packagist.org/packages/trikoder/oauth2-bundle)\n[![License](https://poser.pugx.org/trikoder/oauth2-bundle/license)](https://packagist.org/packages/trikoder/oauth2-bundle)\n[![Code coverage](https://codecov.io/gh/trikoder/oauth2-bundle/branch/master/graph/badge.svg)](https://codecov.io/gh/trikoder/oauth2-bundle)\n\nSymfony bundle which provides OAuth 2.0 authorization/resource server capabilities. The authorization and resource server actors are implemented using the [thephpleague/oauth2-server](https://github.com/thephpleague/oauth2-server) library.\n\n## Important notes\n\nThis bundle provides the \"glue\" between  [thephpleague/oauth2-server](https://github.com/thephpleague/oauth2-server) library and Symfony.\nIt implements [thephpleague/oauth2-server](https://github.com/thephpleague/oauth2-server) library in a way specified by its official documentation.\nFor implementation into Symfony project, please see [bundle documentation](docs/basic-setup.md) and official [Symfony security documentation](https://symfony.com/doc/current/security.html).\n\n## Status ⚠️\n\nActive development is currently on hold, as this repository is in progress of migrating to the [thephpleague/oauth2-server-bundle](https://github.com/thephpleague/oauth2-server-bundle) project.\n\n*The current repository will be **discontinued** whenever the `v1.0` release is ready in [oauth2-server-bundle](https://github.com/thephpleague/oauth2-server-bundle/releases).*\n*See [this comment](https://github.com/trikoder/oauth2-bundle/pull/292#issuecomment-990943939) for more information.*\n\n## Features\n\n* API endpoint for client authorization and token issuing\n* Configurable client and token persistance (includes [Doctrine](https://www.doctrine-project.org/) support)\n* Integration with Symfony's [Security](https://symfony.com/doc/current/security.html) layer\n\n## Requirements\n\n* [PHP 7.2](http://php.net/releases/7_2_0.php) or greater\n* [Symfony 4.4](https://symfony.com/roadmap/4.4) or [Symfony 5.x](https://symfony.com/roadmap/5.0)\n\n## Installation\n\n1. Require the bundle and a PSR 7/17 implementation with Composer:\n\n    ```sh\n    composer require trikoder/oauth2-bundle nyholm/psr7\n    ```\n\n    If your project is managed using [Symfony Flex](https://github.com/symfony/flex), the rest of the steps are not required. Just follow the post-installation instructions instead! :tada:\n\n    \u003e **NOTE:** This bundle requires a PSR 7/17 implementation to operate. We recommend that you use [nyholm/psr7](https://github.com/Nyholm/psr7). Check out this [document](docs/psr-implementation-switching.md) if you wish to use a different implementation.\n\n1. Create the bundle configuration file under `config/packages/trikoder_oauth2.yaml`. Here is a reference configuration file:\n\n    ```yaml\n    trikoder_oauth2:\n        authorization_server: # Required\n\n            # Full path to the private key file.\n            # How to generate a private key: https://oauth2.thephpleague.com/installation/#generating-public-and-private-keys\n            private_key:          ~ # Required, Example: /var/oauth/private.key\n\n            # Passphrase of the private key, if any.\n            private_key_passphrase: null\n\n            # The plain string or the ascii safe string used to create a Defuse\\Crypto\\Key to be used as an encryption key.\n            # How to generate an encryption key: https://oauth2.thephpleague.com/installation/#string-password\n            encryption_key:       ~ # Required\n\n            # The type of value of \"encryption_key\".\n            encryption_key_type:  plain # One of \"plain\"; \"defuse\"\n\n            # How long the issued access token should be valid for, used as a default if there is no grant type specific value set.\n            # The value should be a valid interval: http://php.net/manual/en/dateinterval.construct.php#refsect1-dateinterval.construct-parameters\n            access_token_ttl:     PT1H\n\n            # How long the issued refresh token should be valid for, used as a default if there is no grant type specific value set.\n            # The value should be a valid interval: http://php.net/manual/en/dateinterval.construct.php#refsect1-dateinterval.construct-parameters\n            refresh_token_ttl:    P1M\n\n            # How long the issued authorization code should be valid for.\n            # The value should be a valid interval: http://php.net/manual/en/dateinterval.construct.php#refsect1-dateinterval.construct-parameters\n            auth_code_ttl:        ~ # Deprecated (\"trikoder_oauth2.authorization_server.auth_code_ttl\" is deprecated, use \"trikoder_oauth2.authorization_server.grant_types.authorization_code.auth_code_ttl\" instead.)\n\n            # Whether to require code challenge for public clients for the authorization code grant.\n            require_code_challenge_for_public_clients: ~ # Deprecated (\"trikoder_oauth2.authorization_server.require_code_challenge_for_public_clients\" is deprecated, use \"trikoder_oauth2.authorization_server.grant_types.authorization_code.require_code_challenge_for_public_clients\" instead.)\n\n            # Whether to enable the authorization code grant.\n            enable_auth_code_grant: ~ # Deprecated (\"trikoder_oauth2.authorization_server.enable_auth_code_grant\" is deprecated, use \"trikoder_oauth2.authorization_server.grant_types.authorization_code.enable\" instead.)\n\n            # Whether to enable the client credentials grant.\n            enable_client_credentials_grant: ~ # Deprecated (\"trikoder_oauth2.authorization_server.enable_client_credentials_grant\" is deprecated, use \"trikoder_oauth2.authorization_server.grant_types.client_credentials.enable\" instead.)\n\n            # Whether to enable the implicit grant.\n            enable_implicit_grant: ~ # Deprecated (\"trikoder_oauth2.authorization_server.enable_implicit_grant\" is deprecated, use \"trikoder_oauth2.authorization_server.grant_types.implicit.enable\" instead.)\n\n            # Whether to enable the password grant.\n            enable_password_grant: ~ # Deprecated (\"trikoder_oauth2.authorization_server.enable_password_grant\" is deprecated, use \"trikoder_oauth2.authorization_server.grant_types.password.enable\" instead.)\n\n            # Whether to enable the refresh token grant.\n            enable_refresh_token_grant: ~ # Deprecated (\"trikoder_oauth2.authorization_server.enable_refresh_token_grant\" is deprecated, use \"trikoder_oauth2.authorization_server.grant_types.refresh_token.enable\" instead.)\n\n            # Enable and configure grant types.\n            grant_types:\n                authorization_code:\n\n                    # Whether to enable the authorization code grant.\n                    enable:               true\n\n                    # How long the issued access token should be valid for the authorization code grant.\n                    access_token_ttl:     ~\n\n                    # How long the issued refresh token should be valid for the authorization code grant.\n                    refresh_token_ttl:    ~\n\n                    # How long the issued authorization code should be valid for.\n                    # The value should be a valid interval: http://php.net/manual/en/dateinterval.construct.php#refsect1-dateinterval.construct-parameters\n                    auth_code_ttl:        PT10M\n\n                    # Whether to require code challenge for public clients for the authorization code grant.\n                    require_code_challenge_for_public_clients: true\n                client_credentials:\n\n                    # Whether to enable the client credentials grant.\n                    enable:               true\n\n                    # How long the issued access token should be valid for the client credentials grant.\n                    access_token_ttl:     ~\n                implicit:\n\n                    # Whether to enable the implicit grant.\n                    enable:               true\n\n                    # How long the issued access token should be valid for the implicit grant.\n                    access_token_ttl:     ~\n                password:\n\n                    # Whether to enable the password grant.\n                    enable:               true\n\n                    # How long the issued access token should be valid for the password grant.\n                    access_token_ttl:     ~\n\n                    # How long the issued refresh token should be valid for the password grant.\n                    refresh_token_ttl:    ~\n                refresh_token:\n\n                    # Whether to enable the refresh token grant.\n                    enable:               true\n\n                    # How long the issued access token should be valid for the refresh token grant.\n                    access_token_ttl:     ~\n\n                    # How long the issued refresh token should be valid for the refresh token grant.\n                    refresh_token_ttl:    ~\n        resource_server:      # Required\n\n            # Full path to the public key file.\n            # How to generate a public key: https://oauth2.thephpleague.com/installation/#generating-public-and-private-keys\n            public_key:           ~ # Required, Example: /var/oauth/public.key\n\n        # Scopes that you wish to utilize in your application.\n        # This should be a simple array of strings.\n        scopes:               []\n\n        # Configures different persistence methods that can be used by the bundle for saving client and token data.\n        # Only one persistence method can be configured at a time.\n        persistence:          # Required\n            doctrine:\n\n                # Name of the entity manager that you wish to use for managing clients and tokens.\n                entity_manager:       default\n            in_memory:            ~\n\n        # The priority of the event listener that converts an Exception to a Response.\n        exception_event_listener_priority: 10\n\n        # Set a custom prefix that replaces the default \"ROLE_OAUTH2_\" role prefix.\n        role_prefix:          ROLE_OAUTH2_\n    ```\n\n1. Enable the bundle in `config/bundles.php` by adding it to the array:\n\n    ```php\n    Trikoder\\Bundle\\OAuth2Bundle\\TrikoderOAuth2Bundle::class =\u003e ['all' =\u003e true]\n    ```\n\n1. Update the database so bundle entities can be persisted using Doctrine:\n\n    ```sh\n    bin/console doctrine:schema:update --force\n    ```\n\n1. Import the routes inside your `config/routes.yaml` file:\n\n    ```yaml\n    oauth2:\n        resource: '@TrikoderOAuth2Bundle/Resources/config/routes.xml'\n    ```\n\nYou can verify that everything is working by issuing a `POST` request to the `/token` endpoint.\n\n**❮ NOTE ❯** It is recommended to control the access to the authorization endpoint\nso that only logged in users can approve authorization requests.\nYou should review your `security.yml` file. Here is a sample configuration:\n\n```yaml\nsecurity:\n    access_control:\n        - { path: ^/authorize, roles: IS_AUTHENTICATED_REMEMBERED }\n```\n\n## Configuration\n\n* [Basic setup](docs/basic-setup.md)\n* [Controlling token scopes](docs/controlling-token-scopes.md)\n* [Password grant handling](docs/password-grant-handling.md)\n* [Implementing custom grant type](docs/implementing-custom-grant-type.md)\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n## Versioning\n\nThis project adheres to [Semantic Versioning 2.0.0](http://semver.org/). Randomly breaking public APIs is not an option.\n\nHowever, starting with version 4, we only promise to follow SemVer on structural elements marked with the [@api tag](https://github.com/php-fig/fig-standards/blob/2668020622d9d9eaf11d403bc1d26664dfc3ef8e/proposed/phpdoc-tags.md#51-api).\n\n## Changes\n\nAll the package releases are recorded in the [CHANGELOG](CHANGELOG.md) file.\n\n## Reporting issues\n\nUse the [issue tracker](https://github.com/trikoder/oauth2-bundle/issues) to report any issues you might have.\n\n## License\n\nSee the [LICENSE](LICENSE.md) file for license rights and limitations (MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrikoder%2Foauth2-bundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrikoder%2Foauth2-bundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrikoder%2Foauth2-bundle/lists"}