Add optional CooperativelyManagedOAuth2 functionality to always check for new tokens
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- python
- Domain
- authentication
Research direction
Start with CooperativelyManagedOAuth2Mixin, especially _get_tokens(), _get_and_update_current_tokens(), and the access_token property used by BoxSession. Trace how refresh(), revoke(), and API requests obtain tokens, then compare the subclass and initialization-parameter options. Done means the chosen optional behavior is specified, implemented, and covered for both cached and freshly retrieved tokens.
Written by the indexing model from the issue text.
Description
CooperativelyManagedOAuth2Mixin overrides _get_tokens(). When refresh() or revoke() are called, this protected method is called to get the latest tokens. However, the access_token property (used by BoxSession for all API requests) still uses the cached _access_token attribute.
During normal usage, this means that, after another instance has done a refresh, the BoxSession will usually make one API call with expired tokens before grabbing the updated tokens.
This makes sense as a default behavior. If the cooperative auth is happening over a network, then the cost of one extra API call per hour is much less than checking for new tokens for every single API call.
But if the cooperation is happening within a process and the mechanism is low-cost, it may be more economical to override the access_token property to always call _get_and_update_current_tokens() before returning the _access_token attribute.
This can be done with a CooperativelyManagedOAuth2Mixin subclass, or an __init__ parameter to toggle the behavior.
There's also the question of whether this is useful functionality to add to the SDK.
- Dominant language
- Python
- Stars
- 460
- Forks
- 223
- Avg merge
- 14h 18m
- Merged PRs (30d)
- 21
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from box/box-python-sdk
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
box/box-python-sdk#196 ·
-
bug enhancement
box/box-python-sdk#1314 · 6 comments · 5 assignees ·
-
enhancement
box/box-python-sdk#1154 · 3 comments · 5 assignees ·
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 25/100
box/box-python-sdk#1155 · 1 comment · 4 reactions ·
-
enhancement
box/box-python-sdk#1157 · 1 comment · 6 assignees ·
All issues in box/box-python-sdk
Similar issues
-
essnmx good first issue
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
[Feature] 奇物选择添加优先级 Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
syfoud/Simulated_Scepter#174 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Giskard-AI/giskard-oss#2840 · 1 comment ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success Openarea: repo bug perceived difficulty: 2
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
yeti-platform/yeti#1380 ·