Skip to content
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

add save_token feature #71

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

bcarrella
Copy link

Implemented new feature to allow saving of tokens to current working directory for later use (e.g. use in script).

@bcarrella bcarrella marked this pull request as ready for review January 11, 2024 17:10
@junyer
Copy link
Contributor

junyer commented Jan 12, 2024

Thanks for the PR! Could you please explain what problem is being solved for most users of python/oauth2.py? Specifically, why might one want to specify --save_token (note that there's no corresponding --load_token) and, moreover, why might one need to save both tokens?

@bcarrella
Copy link
Author

Hi, in my use case, I need to develop shell script to schedule email fetching. I need to persist token info between different runs avoiding to refresh token until expires. I would like to delegate all the oauth2 stuff to this script. I need to save both tokens because the initial_token.json will store refresh_token data, the refreshed_token.js will store the actual acces_token to use for IMAP authentication. I hope my intention is more clear know. Maybe a --load_token feature can be useful, but is not my priority at the moment.

@junyer
Copy link
Contributor

junyer commented Jan 12, 2024

Thanks for the explanation! In that case, I'm not sure why the existing --quiet option isn't sufficient? When a user specifies --generate_oauth2_token, they would visit the URL in their browser (i.e. this step is necessarily interactive) and presumably then persist the refresh token manually. The subsequent steps should already be able to be wrapped with, say, a shell script. (I believe this is why only --refresh_token and --generate_oauth2_string behave differently when --quiet is specified.)

Copy link

@angelalarabanda angelalarabanda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Entrar

@@ -74,7 +74,7 @@
import sys
import urllib.parse
import urllib.request

import os

This comment was marked as duplicate.

@@ -74,7 +74,7 @@
import sys
import urllib.parse
import urllib.request

import os

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants