-
Notifications
You must be signed in to change notification settings - Fork 4.9k
fix(source-okta): Fix OAuth with private key PEM parsing issue #69831
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
base: master
Are you sure you want to change the base?
fix(source-okta): Fix OAuth with private key PEM parsing issue #69831
Conversation
The private key string from Airbyte Cloud contains escaped newlines (\n) instead of actual newline characters, causing PyJWT to fail parsing the PEM-formatted key with 'InvalidKeyError: Could not parse the provided public key.' This fix normalizes the escaped newlines to actual newlines before passing the key to jwt.encode(), following the same pattern used in other parts of the codebase (see commit e53e290). This resolves the issue for both the Okta connector and any other connectors using OAuth with private key authentication in the connector builder. Co-Authored-By: [email protected] <[email protected]>
Original prompt from [email protected] |
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
👋 Greetings, Airbyte Team Member!Here are some helpful tips and reminders for your convenience. Helpful Resources
PR Slash CommandsAirbyte Maintainers (that's you!) can execute the following slash commands on your PR:
|
|
Co-Authored-By: [email protected] <[email protected]>
|
Deploy preview for airbyte-docs ready! ✅ Preview Built with commit 77d45c0. |
What
Fixes a critical issue where OAuth authentication with private key fails in the Okta connector (and potentially other connectors using OAuth with private key in the connector builder) with the error:
This occurs because the private key string from Airbyte Cloud contains escaped newlines (
\\n) instead of actual newline characters, causing PyJWT to fail parsing the PEM-formatted key.How
Added a normalization step in
CustomOauth2PrivateKeyAuthenticator.token()that converts escaped newlines to actual newlines before passing the private key tojwt.encode(). This follows the same pattern used elsewhere in the codebase (see commit e53e290).Review guide
airbyte-integrations/connectors/source-okta/source_okta/components.py- Review the normalization logic in thetoken()method (lines 91-93)User Impact
Positive:
Negative:
Can this PR be safely reverted and rolled back?
The change is minimal and only affects the OAuth with private key authentication flow. Reverting would simply restore the broken behavior.
Link to Devin run: https://app.devin.ai/sessions/ccfafd12c230478f82106eb1bac5de88
Requested by: @Airbyte-Support ([email protected])
Note: This fix was implemented based on error logs and pattern matching with historical fixes in the codebase. Ideally, this should be tested with an actual Okta instance using OAuth with private key authentication before merging.