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

Exit status code 18: Token has been expired or revoked #282

Closed
hudcap opened this issue Jul 19, 2020 · 7 comments
Closed

Exit status code 18: Token has been expired or revoked #282

hudcap opened this issue Jul 19, 2020 · 7 comments
Labels

Comments

@hudcap
Copy link

hudcap commented Jul 19, 2020

Full steps to reproduce the issue:
I have an account setup for read-only backup that runs daily. It worked successfully many times.
I run my backups with the following:

gyb --email *****@gmail.com --local-folder C:\Users\****\GYB-GMail-Backup-****@gmail.com --fast-incremental

Expected outcome (what are you trying to do?):
A successful backup

Actual outcome (what errors or bad behavior do you see instead?):
Exit status code 18

ERROR: ('invalid_grant: Token has been expired or revoked.', '{\n  "error": "invalid_grant",\n  "error_description": "Token has been expired or revoked."\n}')

The request to refresh tokens is failing even though it has worked until a few days ago. I have not invalidated the GYB authorization in my account.

@g1th4ck
Copy link

g1th4ck commented Jul 30, 2020

I have a similar problem.

In my case i get the following error:

ERROR: ('invalid_grant: Bad Request', '{\n "error": "invalid_grant",\n "error_description": "Bad Request"\n}')

It seems my weekly backups stopped working two weeks ago. I discovered the GAM project access in my account was deleted, so i tried to recreate the project, but even after doing it, it doesn't work anymore.

I suspect something has happened either with the GAM project or with Google Cloud Platform.

@stale
Copy link

stale bot commented Oct 28, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the wontfix label Oct 28, 2020
@stale stale bot closed this as completed Nov 5, 2020
@sundeepnarang
Copy link

sundeepnarang commented Mar 27, 2021

A simple manual fix for me was to delete cfg files for mailbox and run backup again. This causes OAuth token to be regenerated. The cfg files were at /home/USER/bin/gyb/[email protected]

@yesrod
Copy link

yesrod commented Mar 30, 2021

Google, in their infinite wisdom, has limited authorization for "testing" projects to seven days. After seven days, the token expires and must be reauthorized.

https://support.google.com/cloud/answer/10311615?hl=en#zippy=%2Ctesting

@brechmos
Copy link

I followed the directions in the Wiki to create the App etc. I hit this 7 day issue, but am now confused.

  • Do I publish the App? It says it would be open to the world (but there is authentication)
  • Is there an automated way to re-up the expired token automatically in a script so I can re-up automatically before the 7 day expiration

I understand this is a Google question but it is related to GYB.

@davidedg
Copy link

davidedg commented Nov 22, 2024

Google, in their infinite wisdom, has limited authorization for "testing" projects to seven days. After seven days, the token expires and must be reauthorized.

https://support.google.com/cloud/answer/10311615?hl=en#zippy=%2Ctesting

Not sure if this is by design or if it will break in the future... but, I think I might have a workaround.
If I inspect the 3rd party apps authorization that was created when the app is in TEST mode, there is an expiration date (7 days after creation), that's expected.
I removed this authorization completely, then I published the app (no app validation was required).
Next, I ran the account validation again (e.g. with the estimate action) and allowed the permissions from a browser (this time, Google warned me many times that this is an unverified app).
When this was done, I inspected the 3rd party app authorization once again and this time there was NO expiration date, again as expected.

Now, the workaround is simply to go back to the app setting and set it back to TEST mode (and re-add yourself as the only test user).
The app authorization will still have no expiration date!

I hope this will not change in the future!

@durd
Copy link

durd commented Jan 4, 2025

Trying this suggestion right now. My GYB app seems to not have an expire date anymore, but the downloaded token does have an expiry. I should notice in ~30min if that has any impact to anything.
I had to delete my <email>.cfg file for the --action estimate to trigger a new authorization in which I deselected the G-suite authorizations (type 5<enter> and 6<enter> and then 7<enter> to continue with full read/write)
To check your apps expiry, this is the link to use: https://myaccount.google.com/connections, not GAM Project creation, that is a different app used to create projects in your google account)

Edit: no worries about the token expiring, it's prolonged with an hour. I guess when GYB accesses your app.

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

No branches or pull requests

7 participants