-
Notifications
You must be signed in to change notification settings - Fork 178
gcal: replace oob OAuth2 with local server redirect #985
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
Conversation
WhyNotHugo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
This won't work in some specific scenarios (notably, when vdirsyncer is not running on the local host), but I don't think Google has presented any replacement for the API they've deprecated, so it doesn't seem like we have a choice here.
I mostly have minor feedback, I'll try this properly when I have the time, but generally makes sense.
| thread.start() | ||
| self._redirect_uri = f"http://{host}:{local_server.server_port}" | ||
| async with self._session as session: | ||
| # Fail fast if the address is occupied |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is pending?
vdirsyncer/storage/google.py
Outdated
| self.last_request_uri = None | ||
| self._success_message = success_message | ||
|
|
||
| def __call__(self, environ, start_response): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| def __call__(self, environ, start_response): | |
| def __call__(self, environ: Dict[str, Any], start_response: Callable[[str], list]) -> Iterable[byte]: |
51d6798 to
d7c9acf
Compare
8ea1217 to
ebf5ea0
Compare
|
I've moved all code taken from I tested this on my local setup and it seems to work, will merge as soon as CI is done running. |
Google Calendar has disabled the oob method for new credentials (see https://developers.google.com/identity/protocols/oauth2/native-app), so new users cannot currently use Google Calendar. Fix this by switching to a loopback redirect_uri flow instead. Co-authored-by: Hugo Osvaldo Barrera <[email protected]>
4030432 to
baaf737
Compare
|
Thanks! |
Google Calendar has disabled the oob method for new credentials (see
https://developers.google.com/identity/protocols/oauth2/native-app), so
new users cannot currently use Google Calendar. Fix this by switching to
a loopback redirect_uri flow instead.
This is completely secure - Javascript on the OAuth2 authentication page
opened by the workflow makes a single GET request to a server listening
only on 127.0.0.1. Once the authentication page makes the GET request,
the local web server is not needed anymore and is immediately shut down.
Fix #975