Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ Changes
Unreleased
====================================================================================================================

Changes:

* Fix ``twitcher.oauth2.CustomTokenValidator`` allowing non-string or empty ``issuer`` and ``secret`` configuration.
This ended up raising an error ``CustomTokenValidator.generate_access_token()`` call since the parameters must be
valid and defined strings for the ``jwt.encode`` function.

0.11.1 (2026-01-09)
====================================================================================================================

Expand Down
1 change: 1 addition & 0 deletions tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class BaseTest(unittest.TestCase):
'twitcher.password': 'testpassword',
'twitcher.token.type': 'custom_token',
'twitcher.token.secret': 'testsecret',
'twitcher.token.issuer': 'testissuer',
}

def setUp(self):
Expand Down
2 changes: 2 additions & 0 deletions twitcher/oauth2.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ def validate_bearer_token(self, token, scopes, request):

class CustomTokenValidator(BaseValidator):
def __init__(self, secret, issuer):
if not secret or not issuer or not isinstance(secret, str) or not isinstance(issuer, str):
raise ValueError('OAuth2 custom token secret and issuer must both be non-empty strings')
self.secret = secret
self.issuer = issuer

Expand Down
Loading