fix(jwt): log decode errors for better debugging
Some checks failed
ci / ci (push) Failing after 0s

Added error logging to capture JWT decode exceptions, aiding in pinpointing issues during authentication. This change improves troubleshooting and enhances the overall robustness of the JWT handling process.
This commit is contained in:
Kumi 2024-06-25 19:37:22 +02:00
parent 5ae53cfc14
commit 92ed01adc5
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -99,6 +99,7 @@ class core_jwt_manager
try { try {
$decoded = JWT::decode($keyvalue, new Key($secret, 'HS256')); $decoded = JWT::decode($keyvalue, new Key($secret, 'HS256'));
} catch (\Exception $e) { } catch (\Exception $e) {
error_log('JWT decode error: ' . $e->getMessage());
throw new \moodle_exception('invalidkey'); throw new \moodle_exception('invalidkey');
} }