antigravity

package
v6.8.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 12, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package antigravity provides OAuth2 authentication functionality for the Antigravity provider.

Package antigravity provides OAuth2 authentication functionality for the Antigravity provider.

Index

Constants

View Source
const (
	ClientID     = "1071006060591-tmhssin2h21lcre235vtolojh4g403ep.apps.googleusercontent.com"
	ClientSecret = "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"
	CallbackPort = 51121
)

OAuth client credentials and configuration

View Source
const (
	TokenEndpoint    = "https://oauth2.googleapis.com/token"
	AuthEndpoint     = "https://accounts.google.com/o/oauth2/v2/auth"
	UserInfoEndpoint = "https://www.googleapis.com/oauth2/v1/userinfo?alt=json"
)

OAuth2 endpoints for Google authentication

View Source
const (
	APIEndpoint    = "https://cloudcode-pa.googleapis.com"
	APIVersion     = "v1internal"
	APIUserAgent   = "google-api-nodejs-client/9.15.1"
	APIClient      = "google-cloud-sdk vscode_cloudshelleditor/0.1"
	ClientMetadata = `{"ideType":"IDE_UNSPECIFIED","platform":"PLATFORM_UNSPECIFIED","pluginType":"GEMINI"}`
)

Antigravity API configuration

Variables

View Source
var Scopes = []string{
	"https://www.googleapis.com/auth/cloud-platform",
	"https://www.googleapis.com/auth/userinfo.email",
	"https://www.googleapis.com/auth/userinfo.profile",
	"https://www.googleapis.com/auth/cclog",
	"https://www.googleapis.com/auth/experimentsandconfigs",
}

Scopes defines the OAuth scopes required for Antigravity authentication

Functions

func CredentialFileName

func CredentialFileName(email string) string

CredentialFileName returns the filename used to persist Antigravity credentials. It uses the email as a suffix to disambiguate accounts.

Types

type AntigravityAuth

type AntigravityAuth struct {
	// contains filtered or unexported fields
}

AntigravityAuth handles Antigravity OAuth authentication

func NewAntigravityAuth

func NewAntigravityAuth(cfg *config.Config, httpClient *http.Client) *AntigravityAuth

NewAntigravityAuth creates a new Antigravity auth service.

func (*AntigravityAuth) BuildAuthURL

func (o *AntigravityAuth) BuildAuthURL(state, redirectURI string) string

BuildAuthURL generates the OAuth authorization URL.

func (*AntigravityAuth) ExchangeCodeForTokens

func (o *AntigravityAuth) ExchangeCodeForTokens(ctx context.Context, code, redirectURI string) (*TokenResponse, error)

ExchangeCodeForTokens exchanges authorization code for access and refresh tokens

func (*AntigravityAuth) FetchProjectID

func (o *AntigravityAuth) FetchProjectID(ctx context.Context, accessToken string) (string, error)

FetchProjectID retrieves the project ID for the authenticated user via loadCodeAssist

func (*AntigravityAuth) FetchUserInfo

func (o *AntigravityAuth) FetchUserInfo(ctx context.Context, accessToken string) (string, error)

FetchUserInfo retrieves user email from Google

func (*AntigravityAuth) OnboardUser

func (o *AntigravityAuth) OnboardUser(ctx context.Context, accessToken, tierID string) (string, error)

OnboardUser attempts to fetch the project ID via onboardUser by polling for completion

type TokenResponse

type TokenResponse struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	ExpiresIn    int64  `json:"expires_in"`
	TokenType    string `json:"token_type"`
}

TokenResponse represents OAuth token response from Google

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL