Skip to content
This repository was archived by the owner on Jul 21, 2026. It is now read-only.

add save_token feature - #71

Open
bcarrella wants to merge 2 commits into
google:masterfrom
bcarrella:save_token
Open

add save_token feature#71
bcarrella wants to merge 2 commits into
google:masterfrom
bcarrella:save_token

Conversation

@bcarrella

Copy link
Copy Markdown

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

junyer commented Jan 12, 2024

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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

junyer commented Jan 12, 2024

Copy link
Copy Markdown
Contributor

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.)

@angelalarabanda angelalarabanda left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Entrar

Comment thread python/oauth2.py
import urllib.parse
import urllib.request

import os

This comment was marked as duplicate.

Comment thread python/oauth2.py
import urllib.parse
import urllib.request

import os

This comment was marked as off-topic.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants