dominik-th / matomo-plugin-LoginOIDC

external authentication services for matomo
https://plugins.matomo.org/LoginOIDC/
GNU General Public License v3.0
41 stars 29 forks source link

error using Keycloak #3

Closed chad-cummings-rigil closed 5 years ago

chad-cummings-rigil commented 5 years ago

I have keycloak 4.5.0.Final running locally from a minishift instance which serves it up over HTTPS.

keycloak client for matomo - matomo.json.txt

I have matomo running locally using a docker compose file and served up over HTTP - docker-compose-matomo-mariadb.yml.txt

Matomo version: 3.9.0 MySQL version: 10.3.14-MariaDB-1:10.3.14+maria~bionic PHP version: 7.3.3

I installed the LoginOIDC plugin and configured the URLs, client id and secret, userinfo id and oauth scope.

The matomo login screen shows the Oauth login button and when I click it to redirects to keycloak login. After I login with keycloak user account it redirects back to matomo with error "Unexpected response from OAuth service."

I also have the logs from matomo - matomo.log

I'm not sure what else to troubleshoot.

dominik-th commented 5 years ago

Hi there,

I could not reproduce the issue, using the same Keycloak version. Did you make sure token url and oauth scope are the same as stated in the FAQ?

Is your Matomo instance able to ping your Keycloak server?

If these guesses don't work, please manually add a var_dump($response); in the Controller.php before the exception in line 199:

if (empty($result) || empty($result->access_token)) {
  var_dump($response);
  throw new Exception(Piwik::translate("LoginOIDC_ExceptionInvalidResponse"));
}

the file should be located in ./matomo/plugins/LoginOIDC/Controller.php

Try to login again and post the string which is rendered at the top of the page.

nouhouari commented 4 years ago

If you are running Matomo inside Docker, please check if the IP address is not set to localhost but the external IP for Matomo to be able to reach Keycloak.