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

Document how to generate long-lasting token for Google Drive access #117

Closed
jpmckinney opened this issue Jan 26, 2023 · 0 comments · Fixed by #120
Closed

Document how to generate long-lasting token for Google Drive access #117

jpmckinney opened this issue Jan 26, 2023 · 0 comments · Fixed by #120
Assignees
Labels

Comments

@jpmckinney
Copy link
Member

jpmckinney commented Jan 26, 2023

I downloaded the JSON file from https://console.cloud.google.com/apis/credentials?referrer=search&orgonly=true&project=pelican-289615&supportedpurview=organizationId

I followed the steps at https://stackoverflow.com/questions/66069065/how-to-get-new-refresh-google-oauth-token, i.e.:

Open in a browser (replacing [client-id]) https://accounts.google.com/o/oauth2/auth?client_id=[client-id]&redirect_uri=http://localhost&scope=https://www.googleapis.com/auth/documents%20https://www.googleapis.com/auth/drive&response_type=code&approval_prompt=force&access_type=offline

Then run (replacing bracketed terms):

curl \
  -d "client_id=[client-id]" \
  -d "client_secret=[client-secret]" \
  -d "redirect_uri=http://localhost" \
  -d "grant_type=authorization_code" \
  -d "code=[code-from-redirect-url-above]" \
  "https://www.googleapis.com/oauth2/v4/token"

This yields a token that lasts 1 hour only.

Going through the git history for token.pickle, I found a JSON document like:

{"token": "[token]", "refresh_token": "[refresh_token]", "token_uri": "https://oauth2.googleapis.com/token", "client_id": "[different-client-id]", "client_secret": "[different-client-secret]", "scopes": ["https://www.googleapis.com/auth/documents", "https://www.googleapis.com/auth/drive"]}

It no longer worked, however.

Related: #118

@jpmckinney jpmckinney added this to the Priority milestone Jan 26, 2023
@yolile yolile self-assigned this Jan 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants