DEV Community

Cover image for Solving the Antigravity Authentication Redirect Loop on Windows
lemi melkamu
lemi melkamu

Posted on

Solving the Antigravity Authentication Redirect Loop on Windows

 If you've been trying to set up Google Antigravity on Windows, you might have encountered a frustrating loop: your browser confirms you've signed in, but the desktop app throws a "Failed to exchange authorization code for token" error.

Why this happens
This usually occurs because the underlying gaxios library in the Antigravity build is strictly enforcing TLS/SSL verification. In certain Windows network configurations, this handshake fails during the local callback, preventing the "Authorization Code" from being swapped for an "Access Token."

The Step-by-Step Fix
Step 1: Locate the Source File
Open your File Explorer and head to the local installation directory of the app:
C:\Users<YourUsername>\AppData\Local\Programs\Antigravity\resources\app\node_modules\gaxios\build\cjs\src\

Step 2: Modify gaxios.js
Open the file gaxios.js in your preferred text editor. We need to inject a node environment variable to allow the unauthorized handshake.

Find the HTTPS requirement:

const https_1 = require("https");
Enter fullscreen mode Exit fullscreen mode

Add the following bypass immediately after:

process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
Enter fullscreen mode Exit fullscreen mode

Step 3: Restart and Authenticate
Save the file and restart your Antigravity client. When you click Sign in with Google this time, the app will successfully "catch" the redirect from your browser.

Top comments (0)