nextcloud-oidc-login icon indicating copy to clipboard operation
nextcloud-oidc-login copied to clipboard

Error logging

Open Jonher937 opened this issue 4 years ago • 0 comments

Hi, and first of thanks for the work on this!

I've been dealing with a new IAM solution and got tasked with setting this up to the new IAM product. What I found trying to connect the two was that either the logging is non-existent or I am looking in the wrong place.

During my troubleshooting I ended up adding some temporary debugs to try and see what was going on.

Token contents

I don't expect this one to ever be in the codebase but it was handy for checking the token contents whilst troubleshooting.

https://github.com/pulsejet/nextcloud-oidc-login/blob/master/3rdparty/jumbojett/openid-connect-php/src/OpenIDConnectClient.php#L322 var_dump($token_json); so that I could see the token and check that in JWT.io

Exception

The IAM did not have the /userinfo endoint published in well known, this was not logged anywhere so I made a quick and dirty way of getting the error messages back to my browser, which helped me identify that it was issues trying to reach the userinfo endpoint in the first place.

$noRedirLoginUrl = $this->urlGenerator->linkToRouteAbsolute('core.login.showLoginForm') . '?noredir=1&reason=' . $e->getMessage();

It's not pretty but it did allow me to get some feedback on what was the error and could follow the code better to see what was going on (like uid not being a UUID from the IAM)

Suggestion

There is a box on the login page that nextcloud users for the "Wrong username or password", would be neat if the OIDC exceptions end up there as well so the admin/user gets some feedback on what's going on. Or at least log that to the nextcloud logfile so a admin can follow-up these type of issues

Thank you

Jonher937 avatar Jul 10 '20 10:07 Jonher937