Skip to content

Add more informative 401 error.#19

Merged
tjacovich merged 5 commits intoadsabs:mainfrom
tjacovich:more-informative-401
Jun 12, 2025
Merged

Add more informative 401 error.#19
tjacovich merged 5 commits intoadsabs:mainfrom
tjacovich:more-informative-401

Conversation

@tjacovich
Copy link
Copy Markdown
Contributor

Adds a more verbose 401 error for users who may be using the old Authorization syntax.

@tjacovich tjacovich requested a review from femalves June 11, 2025 15:53
@coveralls
Copy link
Copy Markdown

coveralls commented Jun 11, 2025

Pull Request Test Coverage Report for Build 15617276708

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 1 of 5 (20.0%) changed or added relevant lines in 1 file are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.1%) to 64.906%

Changes Missing Coverage Covered Lines Changed/Added Lines %
apigateway/utils.py 1 5 20.0%
Files with Coverage Reduction New Missed Lines %
apigateway/utils.py 1 48.7%
Totals Coverage Status
Change from base Build 15614572124: -0.1%
Covered Lines: 1143
Relevant Lines: 1761

💛 - Coveralls

Comment thread apigateway/utils.py
@@ -259,6 +260,10 @@ def _construct_remote_url(self) -> str:
class GatewayResourceProtector(ResourceProtector):
def raise_error_response(self, error):
body = json.dumps(dict({"message": error.description}))
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason for the special handling is because the Bearer:TOKEN doesn't register as a Bearer token so authlib throws an UnsupportedTokenTypeError and that does not have a description so the body of the error is empty without additional handling.

@tjacovich tjacovich merged commit 09a8cdf into adsabs:main Jun 12, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants