Comments (9)
So the way oauth2 works is during the auth process gcalcli will create a temporary web server. After you allow access in your browser the browser is redirected back to that web server in gcalcli. That last step is broken for you. There are two major quirks that could cause this. First is, are you using a proxy? If you are then all requests from your browser would go directly to the proxy unless you have exclusion rules which you might need to exclude localhost. The second is your /etc/hosts file. If I remember the browser is trying to resolve "localhost" so make sure that name is pointed to 127.0.0.1 in your /etc/hosts.
The only other thing I can think of is that temporary web server created by gcalcli/oauth2 isn't working properly but I'd think some exception would have been thrown if that were the case. You can verify it's running by examining the output from "netstat -an" during the oauth2 exchange.
from gcalcli.
Hi thanks for the quick reply and explaining how it works. I don't have any proxy configured, and I have a localhost entry for 127.0.0.1 in my hosts file. It appears the webserver is running on port 8080. I've tried browsing to this address from another browser while gcalcli is running, and it's waiting for a response indefinitely. As soon as I kill gcalcli, I get an unable to connect error. So it looks like something is going on with the webserver as you suggested. I'll carry on investigating, hopefully I can figure it out.
from gcalcli.
That's a bummer. Thought it would be something easy. :-)
Check out the (excellent) link on the Google Oauth2 Python API below. We need to figure what that embedded http server is doing, if anything. Maybe turning on logging will help. Add this near the top of gcalcli:
httplib2.debuglevel = 4
https://developers.google.com/api-client-library/python/guide/aaa_oauth
from gcalcli.
Thanks for the pointers. I finally figured out the problem. I read all the Google docs on oauth and looked through the source code of oauth2client.tools. You can see there how the webserver works - it's really basic. In the run procedure, first the webserver is created (but not yet serving requests), then the browser is opened to the authorize URL, then the webserver is told to serve requests (httpd.handlerequest). I realised the browser was being opened in the foreground and it was waiting for the browser to close before continuing, so while the browser is open it's not serving requests. This became more obvious when I actually read the message which is output to console ("Your browser has been opened to visit..."), which wasn't appearing until after I closed the browser. I guess the intention is for the webbrowser.open call to fork the browser process in the background. I finally figured out that if the browser was already open then it works okay, it's only when it has to start the browser itself, it doesn't work. Maybe this is just some quirk with my setup, I do have to set the BROWSER environment variable to get it to work at all, so it could be related to that.
from gcalcli.
Nice! Glad you figured it out. What kind of system are you using and what is BROWSER set to? Curious if this issue is something others might come across in the future.
from gcalcli.
Yes - maybe you can repoduce it if your browser is closed before you run gcalcli, but I doubt it's like that for everyone - can't believe I'm the first person to spot it.
I'm using Arch Linux 64bit, but my default browser is Firefox installed in a 32bit chroot. I have a wrapper script that runs it using schroot, which works fine everywhere else, but when Python tries to execute it I get the following error:
OSError: [Errno 8] Exec format error
I googled it, it's definitely related to the architecture. Python must do something strange when it forks processes - it doesn't work well with chroot.
So I installed Chromium 64bit and set the BROWSER variable before running gcalcli:
export BROWSER=chromium
from gcalcli.
I also use Arch 64bit w/ Chromium. I'm also able to reproduce the problem exactly as you describe it. Simply not having Chromium running during the gcalcli oauth2 process is all that's needed to expose the problem. I'm curious if other platforms have this same issue.
Anyone have access to another Linux distro installation or Mac OS X to test it out?
I think this problem is within the Google oauth2 library and want to get some more information before posting the problem with them.
from gcalcli.
I don't see to have this problem with Chrome on OS X 10.8. I should be able to test with Firefox and Safari too, but it looks like OS X does its processes different enough that there is no issue for me.
from gcalcli.
I tried to reproduce this with the current release on debian. I tried with my default browser (firefox) and with ${BROWSER} set to chromium, both behaved as expected. Since it's been over 5 years since this issue has been updated, I'm closing it under the assumption that it's fixed.
from gcalcli.
Related Issues (20)
- Google Calendar
- Imports are disorganized
- Hourly authentication "The authentication flow has completed."
- Use of summaryOverride HOT 1
- README.md discrepancy
- Importing a .vcs with no events crashes gcalcli
- Formatting and first day of week
- Add option to combine default reminders with custom reminders
- --lineart unicode TypeError: can't concat str to bytes
- App 'gcalcli' is blocked - The out-of-band (OOB) flow has been blocked HOT 8
- DeprecationWarning
- Editing based on unique identifiers?
- Editing an recurring event seems to copy it instead of editing the selected "event instance"
- List Availability
- Access blocked: Authorization Error HOT 1
- HELP: What do I specify? (Documention missing bug)
- HELP!!! GCalCli stopped working! I can only list calendars, and cannot do anything else HOT 11
- Out-Of-Band (OOB) flow
- FEATURE REQUEST: Hooks into `eventTypes` (e.g. "Out of Office" or "Focus Time")
- "Something went wrong" google error when setting up oauth 2.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gcalcli.