Skip to content

Add Antigravity OAuth support with manual token and local import#255

Open
validatedev wants to merge 23 commits intosteipete:mainfrom
validatedev:feat/antigravity-oauth-extras
Open

Add Antigravity OAuth support with manual token and local import#255
validatedev wants to merge 23 commits intosteipete:mainfrom
validatedev:feat/antigravity-oauth-extras

Conversation

@validatedev
Copy link
Contributor

@validatedev validatedev commented Jan 27, 2026

Summary

This pull request adds support for managing Antigravity provider accounts, including OAuth and manual token entry, in the Providers preferences pane. It introduces new UI options for adding, importing, and managing Antigravity credentials, updates the provider descriptor logic, and refines the token account entry experience for providers that require multiple fields. Additionally, it includes dependency and CI updates to support these features.

Antigravity Provider Account Management:

  • Added support for Antigravity accounts in the Providers preferences pane, including segmented manual entry (access token and optional refresh token), Google OAuth sign-in, and importing credentials from the Antigravity app database. The UI dynamically adapts based on provider and system configuration. [1] [2] [3] [4]
  • Implemented error handling and user feedback for credential import, including alerts for missing credentials, database not found, and full disk access requirements.

UI/UX Improvements:

  • Refined the token account entry row to support two-field entry for providers like Antigravity, and adjusted the layout and controls for better usability. [1] [2]
  • Added "Antigravity" to the provider picker in the debug pane for log viewing.

Dependency and Build Updates:

  • Added swift-protobuf as a package dependency and linked it to the main target. [1] [2]
  • Updated CI workflow to install SQLite3, required for reading the Antigravity database.

Security and Configuration:

  • Added a .gitguardian.yml configuration to ignore known public Antigravity OAuth credentials, preventing false positives in secret scanning.

Screenshot

CleanShot 2026-01-29 at 15 09 34@2x

Add OAuth-based authentication for Antigravity provider with multiple credential sources:
- OAuth flow with token refresh capability
- Manual token input in settings
- Local credential import from SQLite database
- Cloud Code API client for quota fetching
- Settings snapshot support for Antigravity provider
@gitguardian
Copy link

gitguardian bot commented Jan 27, 2026

️✅ There are no secrets present in this pull request anymore.

If these secrets were true positive and are still valid, we highly recommend you to revoke them.
While these secrets were previously flagged, we no longer have a reference to the
specific commits where they were detected. Once a secret has been leaked into a git
repository, you should consider it compromised, even if it was deleted immediately.
Find here more information about risks.


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@validatedev
Copy link
Contributor Author

For GitGuardian fail, I cannot do anything as these are the keys which are used by Antigravity itself.

… UI updates

- Added support for two-field token entry in the Antigravity settings.
- Updated the UI for selecting log providers to include Antigravity.
- Enhanced the settings snapshot to include new token management features.
- Implemented credential refresh handling and improved error messaging for Antigravity OAuth.
- Refactored related components for better maintainability and clarity.
@validatedev validatedev marked this pull request as ready for review January 28, 2026 15:06
@validatedev
Copy link
Contributor Author

@steipete when you have time you can review the PR, it’s functionally complete. There are some existing linting errors in CI across the whole repo, so I preferred not to touch those in this PR.

@validatedev validatedev force-pushed the feat/antigravity-oauth-extras branch from 68c145f to 4f76db3 Compare January 28, 2026 21:07
@validatedev validatedev marked this pull request as draft January 28, 2026 22:11
@validatedev
Copy link
Contributor Author

Saw some edge case bug, fixing it. Until then it is draft

@validatedev validatedev marked this pull request as ready for review January 29, 2026 12:10
Copy link
Collaborator

@ratulsarna ratulsarna left a comment

Choose a reason for hiding this comment

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

Sharing focused follow-ups from deep review.

let supportsTwoFieldEntry = isAntigravity
let supportsManualEntry = !isAntigravity || !keychainEnabled
let addActionTitle = isAntigravity ? "Sign in with Google" : nil
let addAction: (() async -> Void)? = isAntigravity
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like manual token entry gets hidden whenever Keychain is enabled (supportsManualEntry = !isAntigravity || !keychainEnabled). That means most users won’t see the manual paste flow even though storage logic supports it. Can we keep manual entry visible and only switch storage backend internally?

public let fetcher: UsageFetcher
public let claudeFetcher: any ClaudeUsageFetching
public let browserDetection: BrowserDetection
public let onAntigravityCredentialsRefreshed: (@Sendable (String, AntigravityOAuthCredentials) -> Void)?
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice addition of this callback hook. One thing to double-check: it looks wired in token-account fetches, but not on the normal provider refresh path. In keychain-disabled mode that can leave refreshed Antigravity tokens/expiry unpersisted during regular refreshes. Could we make sure all app fetch contexts pass this consistently?

message: """
Antigravity database found, but no credentials were found inside.

Please ensure:
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think Full Disk Access failures may get swallowed by this typed catch before we reach the POSIX error branch below. Could we add a dedicated permission-denied case and route it directly to presentFullDiskAccessAlert()?

]

let body = params
.map { "\($0.key)=\($0.value.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) ?? $0.value)" }
Copy link
Collaborator

Choose a reason for hiding this comment

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

We’re building an application/x-www-form-urlencoded body using .urlQueryAllowed. That can be unsafe for form payloads (+, &, = edge cases). Can we switch to a strict form encoder here (and in the token refresher path too)?

credentials: AntigravityOAuthCredentials,
sourceLabel: String) async throws -> ProviderFetchResult
{
let quota = try await AntigravityCloudCodeClient.fetchQuota(accessToken: credentials.accessToken)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we add a fallback when fetchAvailableModels doesn’t return usable quota data? Upstream Code Assist flows usually bootstrap project info and can fall back to retrieveUserQuota, which would make this path more resilient.

@validatedev
Copy link
Contributor Author

@ratulsarna thanks for your valuable feedback! I'll work on them as soon as I'm available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants