-
Notifications
You must be signed in to change notification settings - Fork 8
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
Store OAuth global variables on initial auth #49
Conversation
WalkthroughThe recent changes enhance the OAuth authentication process by introducing two new global variables, Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
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 as PR comments)
Additionally, you can add 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: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- trakt/core.py (2 hunks)
Additional comments not posted (2)
trakt/core.py (2)
262-262
: LGTM! But verify the function usage in the codebase.The code changes are approved.
However, ensure that all function calls to
get_device_token
are correctly handling the new global variables.Verification successful
The new global variables
OAUTH_REFRESH
andOAUTH_EXPIRES_AT
are correctly handled in the codebase.The search results show that these variables are being set and used appropriately in
trakt/core.py
.
OAUTH_REFRESH
andOAUTH_EXPIRES_AT
are set and accessed in multiple locations within the file.- The global variables are integrated into the logic of the authentication process.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `get_device_token` are correctly handling the new global variables. # Test: Search for the function usage. Expect: Only occurrences of the new signature. rg --type python -A 5 $'get_device_token'Length of output: 71
Script:
#!/bin/bash # Description: Verify all function calls to `get_device_token` are correctly handling the new global variables. # Test: Search for the function usage. Expect: Only occurrences of the new signature. rg --type py -A 5 $'get_device_token'Length of output: 1320
Script:
#!/bin/bash # Description: Verify the handling of the new global variables `OAUTH_REFRESH` and `OAUTH_EXPIRES_AT`. # Test: Search for the usage of `OAUTH_REFRESH` and `OAUTH_EXPIRES_AT`. Expect: Occurrences of the new global variables. rg --type py 'OAUTH_REFRESH|OAUTH_EXPIRES_AT'Length of output: 2298
182-182
: LGTM! But verify the function usage in the codebase.The code changes are approved.
However, ensure that all function calls to
oauth_auth
are correctly handling the new global variables.Verification successful
The new global variables are correctly handled in the codebase.
The global variables
OAUTH_REFRESH
andOAUTH_EXPIRES_AT
are properly set and used in various functions, includingoauth_auth
.
trakt/core.py
: Multiple occurrences show correct handling ofOAUTH_REFRESH
andOAUTH_EXPIRES_AT
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `oauth_auth` are correctly handling the new global variables. # Test: Search for the function usage. Expect: Only occurrences of the new signature. rg --type python -A 5 $'oauth_auth'Length of output: 65
Script:
#!/bin/bash # Description: Verify all function calls to `oauth_auth` are correctly handling the new global variables. # Test: Search for the function usage. Expect: Only occurrences of the new signature. rg 'oauth_auth' -A 5Length of output: 911
Script:
#!/bin/bash # Description: Extract the full definition of `oauth_auth` and its usage in the codebase. # Extract the full definition of `oauth_auth`. rg 'def oauth_auth' -A 20 # Extract all occurrences of `oauth_auth` usage in the codebase. rg 'oauth_auth' -A 5Length of output: 2284
Script:
#!/bin/bash # Description: Verify the usage of the new global variables OAUTH_REFRESH and OAUTH_EXPIRES_AT in the codebase. # Search for occurrences of OAUTH_REFRESH in the codebase. rg 'OAUTH_REFRESH' -A 5 # Search for occurrences of OAUTH_EXPIRES_AT in the codebase. rg 'OAUTH_EXPIRES_AT' -A 5Length of output: 10279
What were the symptoms that needed the fix? |
I was trying to store oauth data in my own config but noticed e.g.
|
I noticed when setting up my own OAuth config storage that fetching the values of
core.OAUTH_REFRESH
andcore.OAUTH_EXPIRES_AT
after runningtrakt.init
wasn't working. Turns out that's because while they were being set, they were only being set locally. I made them global inoauth_auth()
andget_device_token()
and it's working now.