The Debug Provider

OAuth2 providers generally require that requests for the registered client come from a specific domain — and this can be problematic when testing your OAuth2 client workflow or pages behind authentication.

To help solve this problem, this package provides a custom league/oauth2-client provider, Phly\Expressive\OAuth2ClientAuthentication\Debug\DebugProvider, along with an associated "authorization" handler.

These features are only enabled when you enable the application debug flag; when that occurs, the debug provider is added to the list of allowed providers, and its authorization handler is mapped to a route.

You can configure both the authorization URI as well as the template for the callback URI in the options array:

// e.g. config/autoload/oauth2-client.local.php:

return [
    'oauth2clientauthentication' => [
        'debug' => [
            'provider' => Debug\DebugProvider::class,
            'options' => [
                // Provide this if you have provided an alternate route path via
                // the oauth2clientauthentication.routes.debug key:
                // 'callback_uri_template' => '/alternate/debug/callback?code=%s&state=%s',

                // Provide this if you want to use an alternate path for the OAuth2
                // "server" authorization:
                // 'authorization_url' => '/alternate/debug/authorization',
            ]
        ],
    ],
];