Skip to content

Conversation

@telotortium
Copy link
Contributor

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

Copy link
Member

@WhyNotHugo WhyNotHugo left a 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pending?

self.last_request_uri = None
self._success_message = success_message

def __call__(self, environ, start_response):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def __call__(self, environ, start_response):
def __call__(self, environ: Dict[str, Any], start_response: Callable[[str], list]) -> Iterable[byte]:

@telotortium telotortium force-pushed the gcal-oauth-remove-oob branch from 51d6798 to d7c9acf Compare June 8, 2022 17:35
@WhyNotHugo WhyNotHugo force-pushed the gcal-oauth-remove-oob branch from 8ea1217 to ebf5ea0 Compare June 22, 2022 15:54
@WhyNotHugo
Copy link
Member

I've moved all code taken from google-auth-library-python-oauthlib into a separate file with a licence header to avoid any conflicts.

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]>
@WhyNotHugo WhyNotHugo force-pushed the gcal-oauth-remove-oob branch from 4030432 to baaf737 Compare June 26, 2022 17:41
@WhyNotHugo WhyNotHugo merged commit 1f7497c into pimutils:master Jun 26, 2022
@WhyNotHugo
Copy link
Member

Thanks!

WhyNotHugo added a commit that referenced this pull request Jan 26, 2023
References: #985
References: #975
Closes: #1028
Closes: #808
WhyNotHugo added a commit that referenced this pull request Feb 16, 2023
References: #985
References: #975
Closes: #1028
Closes: #808
WhyNotHugo added a commit that referenced this pull request Feb 16, 2023
References: #985
References: #975
Closes: #1028
Closes: #808
WhyNotHugo added a commit that referenced this pull request Feb 16, 2023
References: #985
References: #975
Closes: #1028
Closes: #808
@telotortium telotortium deleted the gcal-oauth-remove-oob branch March 15, 2023 00:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

doesn't comply with Google's OAuth 2.0 policy for keeping apps secure

2 participants