knpuniversity / oauth2-client-bundle

Easily talk to an OAuth2 server for social functionality in Symfony
https://symfonycasts.com
MIT License
775 stars 145 forks source link

Unsupported keys when using auto-generated ConfigBuilder class #317

Open ker0x opened 3 years ago

ker0x commented 3 years ago

Since Symfony 5.3, it's possible to use auto-generated Config Builder Classes to configure packages.

When using the Symfony\Config\KnpuOauth2ClientConfig class with the following configuration:

return static function (Symfony\Config\KnpuOauth2ClientConfig $config): void {
    $config
        ->clients('facebook', [
            'type' => 'facebook',
            'client_id' => '%env(OAUTH_FACEBOOK_CLIENT_ID)%',
            'client_secret' => '%env(OAUTH_FACEBOOK_CLIENT_SECRET)%',
            'redirect_route' => 'app_social_check',
            'redirect_params' => ['provider' => 'facebook'],
            'graph_api_version' => 'v6.0',
        ])
    ;

this error is triggered:

!!    In ClientsConfig.php line 21:
!!
!!    The following keys are not supported by "Symfony\Config\KnpuOauth2Client\Cl
!!    ientsConfig": type, client_id, client_secret, redirect_route, redirect_para
!!    ms, graph_api_version
DonCallisto commented 2 years ago

I think that

$config->clients('facebook',  [
  ...
])

should be

$config->clients([
  'facebook' => [
    ...
  ]
])

Have you tried it? As new configuration is auto-generated, should have nothing to do with this bundle so I guees there's an error in your code.