PHPackages                             beyondbluesky/oauth2-pkce-client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. beyondbluesky/oauth2-pkce-client

ActiveSymfony-bundle[Authentication &amp; Authorization](/categories/authentication)

beyondbluesky/oauth2-pkce-client
================================

OAuth2 Client implementation using PKCE

1.4.3(2mo ago)51.4k↓81.3%CC-BY-NC-SA-4.0PHPPHP &gt;=8.4

Since Aug 27Pushed 2mo agoCompare

[ Source](https://github.com/beyondbluesky/oauth2pkceclient)[ Packagist](https://packagist.org/packages/beyondbluesky/oauth2-pkce-client)[ RSS](/packages/beyondbluesky-oauth2-pkce-client/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (22)Versions (16)Used By (0)

OAuth2 PKCE Enabled Client
==========================

[](#oauth2-pkce-enabled-client)

This Symfony bundle allows a Symfony 8 application to authenticate users against an OAuth2-compliant server using PKCE (RFC 7636).

Compatibility
-------------

[](#compatibility)

- PHP: 8.4+
- Symfony: 8.x

Requirements Overview
---------------------

[](#requirements-overview)

To integrate the bundle, you need:

- A custom authenticator based on Symfony's modern authenticator system
- A controller endpoint that matches your OAuth2 redirect URI
- A table to store PKCE state, verifier, challenge, and issued tokens
- A bundle config file with client and server OAuth2 settings
- Security firewall configuration that uses custom\_authenticators

Installation
------------

[](#installation)

1. Install the package:

```
composer require beyondbluesky/oauth2-pkce-client
```

2. Create the bundle config file:

config/packages/oauth2\_pkce\_client.yaml

```
oauth2_pkce_client:
    server_uris:
        auth_uri: https://oauth2.localnet/oauth2/auth
        token_uri: https://oauth2.localnet/oauth2/token
        owner_uri: https://oauth2.localnet/oauth2/owner
    client:
        id: '%env(resolve:OAUTH2_CLIENT)%'
        secret: '%env(resolve:OAUTH2_SECRET)%'
        scope: '%env(resolve:OAUTH2_SCOPE)%'
        redirect_uri: '%env(resolve:OAUTH2_REDIRECT)%'
        server_cert: '%env(resolve:OAUTH2_SERVER_CERT)%'
        cert: '%env(resolve:OAUTH2_CLIENT_CERT)%'
        cert_key: '%env(resolve:OAUTH2_CLIENT_CERT_KEY)%'
```

3. Create the OAuth2 controller with route attributes:

src/Controller/OAuth2Controller.php

```
