-
-
Notifications
You must be signed in to change notification settings - Fork 74
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
Occasional OAuth2 Reauthorization #48
Comments
Yea I have the same issue. I googled about it and it needs to refresh the access token with the refresh token. I think the simplegmail module should have a system for this, but I am new with google APIs so I am not sure. |
I'm running this script in cron (every 30 minutes) so Gmail class is reinitialized each time and I also have problem with token expiring... |
@quinnaissance @KrishGarg @Mr-Groch Sorry for taking so long to get to this issue. This will be implemented very soon. Just to explain what's going on: the reason why restarting the script still runs into this issue is because it will not get a new token when the old token is still good, so it is launched towards the end of the token's lifetime, it expires during the run, and then crashes. Running after expiring will always work since it will ask for a new token now that the old one is expired. Update 1: This is done on a new branch. I will need to continue to wait for tokens to expire to properly test, so this should be available in just over an hour. Update 2: My laptop inexplicably died and has not turned back on. Working on getting onto a new machine. |
@jeremyephron Sorry to hear about the laptop! I am not in a rush so release whenever you're able :) |
This has been added to v4.0.4, which is now available. |
@jeremyephron unfortunately on 4.0.4 I had this issue 2 times in past 2 weeks:
And I had to run manually with |
@Mr-Groch @jeremyephron Unfortunately I have also still had this issue despite upgrading to 4.0.4. It doesn't occur very often but it's definitely still happening. |
Hi @Mr-Groch @quinnaissance, sorry to hear there are intermittent issues. I will add a fix for this as soon as I can test it. Am I correct that to reproduce this you are just running the program for an extended duration, periodically making requests (every 15-30 minutes or so?). I will try to figure out the root issue. |
@jeremyephron I'm using it for notifications related to a reddit bot. The program runs on a loop once per week in a particular time window of about 3-5 hours. However, simplegmail is only being called in two circumstances:
edit: So just to clarify, I'm only calling simplegmail 1-2 times per hour. On average I'd say I encounter this 1-2 times per 3-5 hour runtime. Like I said before, I don't think it's at a specific time interval although I could be wrong. |
I'm using simplegmail in simple python script running in cron every 30 minutes. |
Hi everyone! I am new in gihub, python and google api, so my question might be solved but i cant get how or where. My script was running on VPS, so got in trouble that seems to be described here. Script suppose to run each 10 minutes, exactle in one week i got this: **"Your browser has been opened to visit:
If your browser is on a different machine then exit and re-run this So i stucked on this moment.... Can somebody explain me what shoud be done next? If i run it on my home ps - Authorisation window is being opened, i pass it but i cant do the same on my VPS. Thanks, people. |
Hi folks just started using |
Hello, I have yet to find a workaround unfortunately. |
Hi folks -- After some additional logging and testing, I can confirm what @lemminkeinen suggests: the token seems to expire after exactly one week. I wonder if this is running afoul of limits imposed by Google for "unpublished" apps:
Aside: @jeremyephron is there a particular reason you are using |
Hey folks, a couple different issues being discussed here: auth failures within a week and expiry after a week. @felciano correctly stated that unpublished apps will have their tokens expire after a week. I have no been able to reproduce a quicker failure (e.g., I've had a script sending a message every 20-30 minutes for days on end with no failure). Because it's been so long, I'm going to close this issue. Please open a new issue with more details on the failure and how to reproduce if this is an ongoing problem. |
Is it possible to automate resetting the token using selenium perhaps? |
This may be related to KrishGarg's issue. It seems that I am periodically required to re-authorize via the Google web interface, despite the readme saying this should only occur once. I looked at
gmail_token.json
and sure enough, it has been modified with a newaccess_token
.I can't tell why this is occurring; it doesn't seem to be at any consistent time interval. I printed the exception:
<class 'oauth2client.client.HttpAccessTokenRefreshError'>
But that's all I could get for now.
Edit: It's probably worth noting I initially thought this was occurring because my program was running the same loop for many hours without re-initiating Gmail() (I assumed this would cause the refresh tokens not to update), but I made it re-initiate every hour and this still seems to occur.
The text was updated successfully, but these errors were encountered: