Skip to content

Adding 'authParams' to authClientCollection clients #73

@ldkafka

Description

@ldkafka

Proposed new feature or change

Hi,

There are use cases in which additional OAuth parameters may need to be passed in the URL. For example Google oauth with multiple accounts choices may simply use by default the account that had access previously granted instead of offering to pick another account:

'authClientCollection' => [
            'class' => \yii\authclient\Collection::class,
            'clients' => [
                'google' => [
                    'class' => \yii\authclient\clients\Google::class,
                    'clientId' => 'XXX',
                    'clientSecret' => 'YYY',
                    'scope' => 'openid email profile',
                    'authParams' => [
                        'prompt' => 'select_account', // force account chooser
                        // optional: 'access_type' => 'offline', 'include_granted_scopes' => 'true'
                    ],
                ], ...

I looked through code and additional 'params' are merged in different url building methods (like buildAuthUrl(array $params = [])) with the default auth parameters, however, there is no way to pass those params to the existing methods from the component config.

Could we add/parse/merge an 'authParams' array in config?

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions