-
Notifications
You must be signed in to change notification settings - Fork 25
fix token byte issue #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix token byte issue #65
Conversation
WalkthroughThe Changes
Possibly related PRs
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
kinde_sdk/kinde_api_client.py(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
kinde_sdk/kinde_api_client.py (1)
kinde_sdk/exceptions.py (1)
KindeTokenException(159-160)
🪛 Ruff (0.11.9)
kinde_sdk/kinde_api_client.py
346-346: Within an except clause, raise exceptions with raise ... from err or raise ... from None to distinguish them from errors in exception handling
(B904)
🔇 Additional comments (2)
kinde_sdk/kinde_api_client.py (2)
354-362: LGTM! Good formatting consistency improvements.The formatting changes to the
decode_token_paramsdictionary improve code readability and maintain consistency with the rest of the codebase.
342-347: Excellent backward compatibility fix.The implementation correctly handles the bytes token conversion issue by:
- Detecting bytes tokens before processing
- Using UTF-8 encoding (appropriate for JWT tokens)
- Providing clear error messages for invalid UTF-8 data
- Maintaining the existing logic flow for other token types
This restores backward compatibility while maintaining proper error handling.
🧰 Tools
🪛 Ruff (0.11.9)
346-346: Within an
exceptclause, raise exceptions withraise ... from errorraise ... from Noneto distinguish them from errors in exception handling(B904)
Fix: Restore backward compatibility for bytes tokens
Problem
Version 1.2.8 broke backward compatibility by rejecting
bytestokens in*_tokenmethods likeget_user_details_token(). Code that previously worked with bytes tokens now fails.Fix
Modified
_decode_token_if_needed_value()to automatically convertbytestostrbefore JWT processing: