Skip to content

Don't nest InvalidTokenError extra attribute#872

Merged
azmeuk merged 1 commit intoauthlib:mainfrom
azmeuk:error-extra-attribute
Mar 19, 2026
Merged

Don't nest InvalidTokenError extra attribute#872
azmeuk merged 1 commit intoauthlib:mainfrom
azmeuk:error-extra-attribute

Conversation

@azmeuk
Copy link
Copy Markdown
Member

@azmeuk azmeuk commented Mar 18, 2026

InvalidTokenError.__init__ used **extra_attributes, so passing a dict via extra_attributes={"foo": "bar"} (which is done everywhere) wrapped it as {"extra_attributes": {"foo": "bar"} instead of using the dict directly. The WWW-Authenticate header then contained extra_attributes="{'foo': 'bar'}" instead of foo="bar".

raise InvalidTokenError(
realm=self.realm, extra_attributes=self.extra_attributes
)

Changed the parameter to extra_attributes=None to accept the dict directly.

Checklist

  • The commits follow the conventional commits specification.
  • You ran the linters with prek.
  • You wrote unit test to demonstrate the bug you are fixing, or to stress the feature you are bringing.
  • You reached 100% of code coverage on the code you edited, without abusive use of pragma: no cover
  • You consent that the copyright of your pull request source code belongs to Authlib's author.

@azmeuk azmeuk requested a review from lepture March 18, 2026 17:01
@azmeuk azmeuk merged commit 148ed78 into authlib:main Mar 19, 2026
7 checks passed
@azmeuk azmeuk deleted the error-extra-attribute branch March 19, 2026 16:50
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.

2 participants