-
Notifications
You must be signed in to change notification settings - Fork 3
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
Adds JwtFlow to support JWT authentication #2
Conversation
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.
Thank you for the contribution!
I'm not very familiar with jwt flow in SF - does it support token refreshes?
Also, you don't have to change anything but I'm going to move the dependency to optional later before release - I don't want to require every user to depend on pyjwt as it causes trouble in some cloud environments.
self._expiration_time: float | None = None | ||
|
||
async def _acquire_new_access_token(self, client: "Salesforce") -> str: | ||
expiration = int(time.time()) + 300 |
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.
Shouldn't this use the timeout
attribute you set earlier?
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2 +/- ##
==========================================
- Coverage 92.13% 88.54% -3.59%
==========================================
Files 20 21 +1
Lines 801 847 +46
==========================================
+ Hits 738 750 +12
- Misses 63 97 +34 ☔ View full report in Codecov by Sentry. |
I recommend running pre-commit to avoid lint errors |
To move things forward, are you OK with merging it as is and me taking it over the finish line? I would like to experiment with it myself a bit before committing to a specific interface. You will still be getting credit for contribution. If yes, please revert changes to |
Sure, I've checked in a version that undoes the change. If that's not what's needed, then I'm not sure how to pull out just that change from the original PR |
This adds a new authentication type, JwtFlow. I did not create tests for this because I don't really know how give the infrastructure requirements. Also, I thought the check for sandbox might be better added to the Client, but I but it on the new class instead because I think that should be your design decision.