stevenmaguire / oauth2-keycloak

Keycloak Provider for OAuth 2.0 Client
MIT License
208 stars 151 forks source link

README.md Authorization Code Flow #62

Open mtgtnt opened 1 year ago

mtgtnt commented 1 year ago
$provider = new Stevenmaguire\OAuth2\Client\Provider\Keycloak([
    'authServerUrl'         => '{keycloak-server-url}',
    'realm'                 => '{keycloak-realm}',
    'clientId'              => '{keycloak-client-id}',
    'clientSecret'          => '{keycloak-client-secret}',
    'redirectUri'           => 'https://example.com/callback-url',
    'encryptionAlgorithm'   => 'RS256',                             // optional
    'encryptionKeyPath'     => '../key.pem'                         // optional
    'encryptionKey'         => 'contents_of_key_or_certificate'     // optional
    'version'               => '20.0.1',                            // optional
]);

'version' => '20.0.1', // optional

since 18.0.0 this is required. I just spent 3 days tracking down a 'Invalid response received from Authorization Server. Expected JSON.' error when I finally found that scope:openid was not being added due to requiring this version. Since 20.0.0 it is even more important.

repli2dev commented 1 year ago

After upgrade to 20.0.2 I got this error despite setting this version (and having openid in the scope auth url)