Search code examples
keycloak

What are Keycloak's OAuth2 / OpenID Connect endpoints?


We are trying to evaluate Keycloak as an SSO solution, and it looks good in many respects, but the documentation is painfully lacking in the basics.

For a given Keycloak installation on http://localhost:8080/ for realm test, what are the OAuth2 Authorization Endpoint, OAuth2 Token Endpoint and OpenID Connect UserInfo Endpoint ?

We are not interested in using Keycloak's own client library, we want to use standard OAuth2 / OpenID Connect client libraries, as the client applications using the keycloak server will be written in a wide range of languages (PHP, Ruby, Node, Java, C#, Angular). Therefore the examples that use the Keycloak client aren't of use for us.


Solution

  • For Keycloak 1.9 and above, the above information can be retrieved via the url

    http://keycloakhost:keycloakport/realms/{realm}/.well-known/openid-configuration
    

    For example, if the realm name is demo:

    http://keycloakhost:keycloakport/realms/demo/.well-known/openid-configuration
    

    An example output from above url:

    {
        "issuer": "http://localhost:8080/realms/demo",
        "authorization_endpoint": "http://localhost:8080/realms/demo/protocol/openid-connect/auth",
        "token_endpoint": "http://localhost:8080/realms/demo/protocol/openid-connect/token",
        "userinfo_endpoint": "http://localhost:8080/realms/demo/protocol/openid-connect/userinfo",
        "end_session_endpoint": "http://localhost:8080/realms/demo/protocol/openid-connect/logout",
        "jwks_uri": "http://localhost:8080/realms/demo/protocol/openid-connect/certs",
        "grant_types_supported": [
            "authorization_code",
            "refresh_token",
            "password"
        ],
        "response_types_supported": [
            "code"
        ],
        "subject_types_supported": [
            "public"
        ],
        "id_token_signing_alg_values_supported": [
            "RS256"
        ],
        "response_modes_supported": [
            "query"
        ]
    }
    

    Found information at https://issues.jboss.org/browse/KEYCLOAK-571

    Note: You might need to add your client to the Valid Redirect URI list