dominik-th / matomo-plugin-LoginOIDC

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

WHMCS error #48

Open flexxdesign opened 3 years ago

flexxdesign commented 3 years ago

Getting this error message when trying to "Login with WHMCS" after setting up this plugin. I've used http(s)://<YOUR_MATOMO_URL>/index.php?module=LoginOIDC&action=callback&provider=oidc format as Authorized Redirect URI.

Error message from WHMCS: {"error":"redirect_uri_mismatch","error_description":"The redirect URI provided is missing or does not match","error_uri":"#section-3.1.2"}

Are you able to help me?

dominik-th commented 3 years ago

You can see the redirect url as part of the query parameters. Compare what you've entered on the authemtication server with what is in this parameter

flexxdesign commented 3 years ago

@dominik-th Thank you for your response! I left the Authorized Redirect URI blank in WHMCS and I’m now able to see the login page.

When trying to login I get the error message Please complete the captcha and try again.

I’m then being forwarded to the WHMCS login screen, where the login does work fine.

After logging in over there I’m getting the error messageUnexpected response from OAuth service. in Matomo.

Do you have the solution for me?

flexxdesign commented 3 years ago

I've added var_dump($response); to if (empty($result) || empty($result->access_token)) {var_dump($response); throw new Exception(Piwik::translate("LoginOIDC_ExceptionInvalidResponse"));

Result: string(128) "{"error":"redirect_uri_mismatch","error_description":"The redirect URI is missing or do not match","error_uri":"#section-4.1.3"}"

I can't manage to fix this issue, see other comments in this issue.