Skip to content

Instantly share code, notes, and snippets.

@maestrofx
Created October 21, 2025 06:50
Show Gist options
  • Select an option

  • Save maestrofx/410afef84848d058595ed047e8f9fc89 to your computer and use it in GitHub Desktop.

Select an option

Save maestrofx/410afef84848d058595ed047e8f9fc89 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>OAuth Callback</title>
</head>
<body>
<script>
// This script runs when Google redirects the user to this page.
// 1. Extract the authorization code from the URL.
const urlParams = new URLSearchParams(window.location.search);
const code = urlParams.get('code');
if (code) {
// 2. Send the code back to the main Colab notebook window.
// The '*' target origin is insecure for production, but acceptable for this PoC.
window.opener.postMessage({ type: 'oauth_code', code: code }, '*');
}
// 3. Close this popup window to complete the flow.
window.close();
</script>
<p>Authenticating... you can close this window.</p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment