Google Meet: identify the connected Google account

Merged
EH
21h ago
+111-1

Context

Follows https://github.com/twentyhq/twenty/pull/30600 in the Google Meet app series started in https://github.com/twentyhq/twenty/pull/30587.

Google's event subscriptions target a Google user by id (//cloudidentity.googleapis.com/users/USER), so the app needs the id of the Google account behind each connection before it can subscribe on connect.

What this PR does

  • Adds the google-meet-identify-account logic function and declares it as the provider's identifyAccountLogicFunction. It reads the account id (sub) and email from Google's OpenID Connect userinfo endpoint with the freshly issued token, and returns them as externalAccountId and handle. The openid and email scopes are already requested.
  • Twenty stores that id on the connection, so later PRs read it from getConnection, and a reconnect that authorizes a different Google account is refused instead of silently switching the connection to it. The refusal names the account by its email.
  • The connection is refused when Google returns no account id.

Checks

  • yarn lint, yarn typecheck, yarn test:unit (81 tests) and twenty app build pass locally.
  • Not run: integration tests (they need a running server, CI runs them), and the userinfo call was not made against the real Google API.