Search code examples
keycloakdrupal-modulesdrupal-9keycloak-connectkeycloak-gatekeeper

How to connect Drupal with Keycloak 18 for user creation


I am trying to connect drupal with keycloak for login. I have added client id, client secret and Keycloak realm , getting from keycloak server.

Using modules - https://www.drupal.org/project/keycloak Link - http://localhost/drupal/user/login

After clicked on the 'Login Keycloak button' , getting error The website encountered an unexpected error. Please try again later.

Log Message - Symfony\Component\Routing\Exception\MissingMandatoryParametersException: Some mandatory parameters are missing ("openid_connect_client") to generate a URL for route "openid_connect.redirect_controller_redirect". in Drupal\Core\Routing\UrlGenerator->doGenerate() (line 181 of C:\xampp\htdocs\drupal\core\lib\Drupal\Core\Routing\UrlGenerator.php).

Please suggest. Thank you.


Solution

  • Looks like you might have not added the valid redirect uri in your local keycloak server page under Clients > Settings which I believe should be "http://localhost/drupal/openid-connect/keycloak" for your project.

    And also you need to provide Keycloak base URL in your drupal "Configuration > Web Service> Open ID Connect" web page which most of the times if you are using local keycloak server is http://localhost:8080