This extension adds OIDC support for yii2-authclient.
The preferred way to install this extension is through composer.
Either run
php composer.phar require worteks/yii2auth-oidc
or add
"worteks/yii2auth-oidc": "~0.2"
to the require
section of your composer.json.
You must read the yii2-authclient docs
Set up an OpenID Provider (OP) and configure your Yii2 app as a Relying Party (RP) on your Authentication Server.
Example application configuration:
'components' => [
'authClientCollection' => [
'clients' => [
// ...
'oidc' => [
'class' => 'worteks\yii\authclient\OIDC',
'domain' => 'https://auth.example.com',
'clientId' => 'myClientId',
'clientSecret' => 'myClientSecret',
],
],
// ...
]
Configuration | Mandatory | Default to | Description |
---|---|---|---|
domain | yes | URL of your authentication server | |
clientId | yes | Your client id | |
clientSecret | yes | Your client secret | |
authUrl | no | '/oauth2/authorize' | Authorization Endpoint |
tokenUrl | no | '/oauth2/token' | Token Endpoint |
apiBaseUrl | no | '/oauth2' | Base for Userinfo Endpoint |
userInfoUrl | no | 'userinfo' | Userinfo Endpoint |
scope | yes | 'openid profile email' | What access privileges are being requested |
defaultName | no | Yii auth client id | Auth service name to use in DB record, CSS |
defaultTitle | no | Yii auth client id | Auth service title to display in views |