stevenmaguire / oauth2-keycloak

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

KC20 Support #55

Closed holema closed 1 year ago

holema commented 1 year ago

Hello, thanks for the great project.

Since KC20 is released, a lot of breaking changes took place.

Do you have any plans how to migrate the library to work with the new API.

We faced the first issue, that a user is not fetched with the token. We are going on inspecting the issues, but I think here will be some work.

Best regards

stefanomarty commented 1 year ago

I had the same problem, my webapp stopped functioning after upgrading to KC20 as the call to userinfo returned a null object. I made a few tests with Postman and I found out that KC was returning "unauthorized" due to a missing 'openid' scope in the token request.

As a quick fix I added 'openid' to the getDefaultScopes() function in src/Provider/Keycloak.php:

    /**
     * Get the default scopes used by this provider.
     *
     * This should not be a complete list of all scopes, but the minimum
     * required for the provider user interface!
     *
     * @return string[]
     */
    protected function getDefaultScopes()
    {
        return ['profile', 'email', 'openid'];
    }

I understand this is just a quick fix and that there could be some other broken changes carried by the KC20 upgrade, but for the moment it fixed my webapp problem.

mstefan21 commented 1 year ago

@micbis Released as new version 3.2.0