-
Notifications
You must be signed in to change notification settings - Fork 0
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
Integrate authlib instead of doing oauth manually. #42
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
caarmen
commented
Jan 13, 2024
caarmen
commented
Jan 13, 2024
9bb6b89
to
50e78b6
Compare
caarmen
commented
Jan 14, 2024
caarmen
commented
Jan 19, 2024
c5f09b4
to
f0c0de8
Compare
Configure authlib. Add compliance hooks for withings behavior which deviates from default behavior expected by authlib. For the token update hook: we don't have access to the dependency injection in FastAPI, which provides a db session: yet we need to write the new token to the database. Save the db session in a `ContextVar` to make it accessible from the update token hook. Regarding refreshing the token: * Remove our custom decorator which was refreshing the token upon a 401 error to a resource request. * Adapt `test_retry_authentication` to be `test_refresh_token` * When we get/refresh our access token, save it in the db with an expiration date which is a few minutes sooner than the real one. This will help ensure that we'll fetch a new token when we want to do a resource request and our token is about to expire.
This works for the initial token request, but not for automatic token refresh.
This reverts commit 9bb6b89.
Send the client secret in requests.
Add compliance hooks for fitbit behavior which deviates from default behavior expected by authlib. Regarding refreshing the token: * Remove our custom decorator which was refreshing the token upon a 401 error to a resource request. * When we get/refresh our access token, save it in the db with an expiration date which is a few minutes sooner than the real one. This will help ensure that we'll fetch a new token when we want to do a resource request and our token is about to expire. * Adapt `test_retry_authentication` to be `test_refresh_token`
Fitbit: Integrate authlib instead of doing oauth manually
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Configure authlib.
Add compliance hooks for withings behavior which deviates from default behavior expected by authlib.
For the token update hook: we don't have access to the dependency injection in FastAPI, which provides a db session: yet we need to write the new token to the database. Save the db session in a
ContextVar
to make it accessible from the update token hook.Regarding refreshing the token:
test_retry_authentication
to betest_refresh_token