GithubHelp home page GithubHelp logo

Comments (11)

andrewramsay avatar andrewramsay commented on August 27, 2024

I've noticed this happening as well. Not sure when it started but it never used to be a problem when I originally wrote the script, I think Google have made some relatively recent changes to their OAuth handling and part of that is this limited token validity.

I hadn't had a chance to find a solution for it yet - I just tried switching my own project to "Production" mode and while the URL seems to work it also seems to want to refresh the token on every single request now, so something isn't right! What was the issue with the URL you had? Was it just 404ing or did it display some kind of OAuth error message?

Anyway I'll try to have a look at this during the week sometime, it's been annoying me for a while and I'd like to get it properly fixed. I'll get back to you if I come up with anything that looks like it is working reliably.

from ical_to_gcal_sync.

andrewramsay avatar andrewramsay commented on August 27, 2024

Managed to spend a bit of time looking into this today. I think I have things working again.

I started off with a fresh GCP project and OAuth credentials, not sure if this made any difference but the one I'd been using had been created years ago. Then I added a new "Desktop app" client ID and switched it to Production mode immediately.

After that I had to make some changes to the code, I think part of the problem has been that the various google-* packages in requirements.txt needed updating to newer versions, plus some tweaks to auth.py.

Now things appear to be working again - in particular I can see it's now successfully refreshing the OAuth token without any intervention like it's supposed to do.

The changes I've made are in #29 / this branch. Can you try that out and let me know if it works for you?

from ical_to_gcal_sync.

NordicBlueNL avatar NordicBlueNL commented on August 27, 2024

Hi!
Thanks for the swift response. I have some time tomorrow to test it, will let you know how it worked out!

from ical_to_gcal_sync.

NordicBlueNL avatar NordicBlueNL commented on August 27, 2024

I have updated to your updat_deps branch, removed the client_secret json and pckl, recreated the json with a fresh one after putting the app to production. I do receive a working authorization URL now, but after authorizing the app, it tries to do a callback to http://localhost:38995/ which gives a connection refused.

from ical_to_gcal_sync.

NordicBlueNL avatar NordicBlueNL commented on August 27, 2024

Ah I think I know what happens here, I am running the script on a server and opening the URL on my local computer...

from ical_to_gcal_sync.

NordicBlueNL avatar NordicBlueNL commented on August 27, 2024

I ran the project on my local machine, did the authorization workflow there, and copied the credentials json over to the server. Now it works :)

from ical_to_gcal_sync.

andrewramsay avatar andrewramsay commented on August 27, 2024

I'm doing the same with a headless RPi. The simple workaround is to copy the URL it tries to redirect to and paste it into another SSH session on the server like this curl "redirect_url" so that localhost now refers to the correct device. That should allow the auth flow to complete as expected.

The alternative to this is to modify the parameters used by the call to run_local_server in auth.py. The docs show how you can pass it a host and port of your choosing for the redirect request. But this would naturally require your server to be visible to the internet, if it's on a LAN you'd need to configure port forwarding or something similar long enough to complete the auth flow.


Edit: oops didn't see your last comment, glad it's working! I'll leave these changes unmerged for a few more days in case anything breaks, but I haven't had any trouble yet.

from ical_to_gcal_sync.

NordicBlueNL avatar NordicBlueNL commented on August 27, 2024

I did try it with a curl on the server, but that failed for some reason, it was complaining about missing parameters. Oh well this did the job too :-). Let's see if it keeps working after a week. Thanks!

from ical_to_gcal_sync.

andrewramsay avatar andrewramsay commented on August 27, 2024

Just checking back on this to see if it it's still working before I merge the changes?

It's been running smoothly for me for well over a week now so if it's still OK for you then hopefully that means it'll work for others too!

from ical_to_gcal_sync.

NordicBlueNL avatar NordicBlueNL commented on August 27, 2024

Still works like a charm on this side!

from ical_to_gcal_sync.

andrewramsay avatar andrewramsay commented on August 27, 2024

Great will merge things into master then, thanks!

from ical_to_gcal_sync.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.