Often is the debugging of oAuth2 errror messages a pain. Luckly the OAuthServerException class implements a hint, which helps finding the issue with failing oAuth2 requests.
Unfortunatly this hint is not saved to watchdog. I made a patch which also logs the hint:
Before:
League\OAuth2\Server\Exception\OAuthServerException: The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed. in League\OAuth2\Server\Exception\OAuthServerException::invalidRequest() (line 126 of /home/lessmess/domains/stage.lessmess.io/www/vendor/league/oauth2-server/src/Exception/OAuthServerException.php).
After:
League\OAuth2\Server\Exception\OAuthServerException: The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed. in League\OAuth2\Server\Exception\OAuthServerException::invalidRequest() (line 126 of /home/lessmess/domains/stage.lessmess.io/www/vendor/league/oauth2-server/src/Exception/OAuthServerException.php). Hint: Authorization code has been revoked
I hope this small improvement can be reviewed and commited by a maintainer.
Comments
Comment #2
merilainen commentedLooks simple and works.
Comment #3
bradjones1Thanks for this contribution!
I am marking as active since the last-caller information here is also not very helpful. I am going to convert to a merge-request flow and work on this a bit now.
Comment #4
bradjones1Quick review - this is in theory what we need, though watchdog_exception() is called in 4 different places in this project, so we should probably centralize the handling. Also, the last-caller information that Drupal generates by default just points to the league package, which isn't particularly helpful, so we should probably override this with context from within this module.
Comment #5
bradjones1Comment #6
bojan_dev commentedLogging has been improved in: #3082984: Reduce logging severity/don't log expired tokens/401s