When using Codespaces and Gemini or Claude for A.I development you'll be asked to login using a special link.
But when you open that it results in a broken page, don't close this page yet you'll need it for the fix.

It breaks because the URL contains a Call-back reference to localhost:{PORT#}, but your Codespaces instance is running on an external url https://codespaces_id-{PORT#}.app.github.dev/
To fix this look in the Codespaces Ports Tab, you'll see a newly opened port for Gemini or Claude. In my example it's on port 45349.

Click the Copy Local Address Icon.
Then go back in the tab with the broken URL
Paste this value as a replacement for the localhost:{PORT} part of the tabs URL.

Once replaced visit the full URL, and the call back should be successful.

And the terminal should shortly log you in.
