fix(auth/error): improve error handling of auth issues #3950
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description & motivation
Our logging system showed that some types of errors were being logged twice, the first time as
![Screenshot 2025-02-07 at 11 50 36](https://private-user-images.githubusercontent.com/68657/410899574-56776544-e6f4-4e3a-8a5d-78fa3e8e59f9.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0MzIxMTQsIm5iZiI6MTczOTQzMTgxNCwicGF0aCI6Ii82ODY1Ny80MTA4OTk1NzQtNTY3NzY1NDQtZTZmNC00ZTNhLThhNWQtNzhmYTNlOGU1OWY5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEzVDA3MzAxNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWVlZGNmMWNjOWQyODRjYjM0MDY0ZjU4NTI4ZGY2ZjM0MmVjNWE1MDRhN2UyZjFmYWYxNDA1ZDEwNTM0MTI5ZmYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.2-TvW1hbb9bEwppqhFF0uoV4wI6PKGOxXiOAYvyijTI)
info
level and the second aserror
level:As this is an user-related error, it should only have been logged as
info
level. This PR does not yet address the logging duplication, but addresses the logging levels.Some errors we catch should not be passed to the passportjs callback function, and instead it should only be marked as failure.
From documentation https://www.passportjs.org/concepts/authentication/downloads/html/
Changes:
To-do before merge:
Screenshots:
Validation of changes:
Checklist:
References