antigravity

package
v6.10.9-aug.3 Latest Latest
Warning

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

Go to latest
Published: May 14, 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"
)

OAuth2 endpoints for Google authentication

Variables

This section is empty.

Functions

func BuildMetadata

func BuildMetadata(tokenResp *TokenResponse, email, projectID string) map[string]any

BuildMetadata constructs the standard metadata map for an antigravity token response.

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 Auth

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

Auth handles Antigravity OAuth authentication

func NewAuth

func NewAuth(cfg *config.Config, httpClient *http.Client) *Auth

NewAuth creates a new Antigravity auth service.

func (*Auth) BuildAuthURL

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

BuildAuthURL generates the OAuth authorization URL.

func (*Auth) ExchangeCodeForTokens

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

ExchangeCodeForTokens exchanges authorization code for access and refresh tokens

func (*Auth) FetchProjectID

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

FetchProjectID retrieves the project ID for the authenticated user via loadCodeAssist

func (*Auth) FetchUserInfo

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

FetchUserInfo retrieves user email from Google

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