Repository navigation
fix(bearer-auth): mention verifyToken in missing-options error message - #4987
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4987 +/- ##
=======================================
Coverage 78.78% 78.79%
=======================================
Files 154 154
Lines 10578 10578
Branches 2215 2215
=======================================
+ Hits 8334 8335 +1
+ Misses 2244 2243 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Member
|
Thanks! This is a good improvement. Looks good. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The
bearerAuthmiddleware accepts either atokenor averifyTokenoption, and throws when neither is provided. However, the error message only mentions"token":This is misleading for users who intend to use
verifyToken— the guard fires precisely when neither option is present, so the message should mention both. This also makes the message consistent with the sibling auth middlewares, which already list every accepted option:basic-auth:'basic auth middleware requires options for "username and password" or "verifyUser"'jwk:'JWK auth middleware requires options for either "keys" or "jwks_uri" or both'This PR updates the message to:
and adds a test that asserts the new message (it fails against the previous message and passes with this change).
Author should do the following, if applicable