| @@ -1472,6 +1472,17 @@ func (h *Handler) RequestAntigravityToken(c *gin.Context) { · 1471 unmodified lines |
| 1472 | } | 1472 | } |
| 1473 | } | 1473 | } |
| 1474 | | 1474 | |
| | 1475 | projectID := "" |
| | 1476 | if strings.TrimSpace(tokenResp.AccessToken) != "" { |
| | 1477 | fetchedProjectID, errProject := sdkAuth.FetchAntigravityProjectID(ctx, tokenResp.AccessToken, httpClient) |
| | 1478 | if errProject != nil { |
| | 1479 | log.Warnf("antigravity: failed to fetch project ID: %v", errProject) |
| | 1480 | } else { |
| | 1481 | projectID = fetchedProjectID |
| | 1482 | log.Infof("antigravity: obtained project ID %s", projectID) |
| | 1483 | } |
| | 1484 | } |
| | 1485 | |
| 1475 | now := time.Now() | 1486 | now := time.Now() |
| 1476 | metadata := map[string]any{ | 1487 | metadata := map[string]any{ |
| 1477 | "type": "antigravity", | 1488 | "type": "antigravity", |
| @@ -1484,6 +1495,9 @@ func (h *Handler) RequestAntigravityToken(c *gin.Context) { · 6 unmodified lines |
| 1484 | if email != "" { | 1495 | if email != "" { |
| 1485 | metadata["email"] = email | 1496 | metadata["email"] = email |
| 1486 | } | 1497 | } |
| | 1498 | if projectID != "" { |
| | 1499 | metadata["project_id"] = projectID |
| | 1500 | } |
| 1487 | | 1501 | |
| 1488 | fileName := sanitizeAntigravityFileName(email) | 1502 | fileName := sanitizeAntigravityFileName(email) |
| 1489 | label := strings.TrimSpace(email) | 1503 | label := strings.TrimSpace(email) |
| @@ -1507,6 +1521,9 @@ func (h *Handler) RequestAntigravityToken(c *gin.Context) { · 17 unmodified lines |
| 1507 | | 1521 | |
| 1508 | delete(oauthStatus, state) | 1522 | delete(oauthStatus, state) |
| 1509 | fmt.Printf("Authentication successful! Token saved to %s\n", savedPath) | 1523 | fmt.Printf("Authentication successful! Token saved to %s\n", savedPath) |
| | 1524 | if projectID != "" { |
| | 1525 | fmt.Printf("Using GCP project: %s\n", projectID) |
| | 1526 | } |
| 1510 | fmt.Println("You can now use Antigravity services through this CLI") | 1527 | fmt.Println("You can now use Antigravity services through this CLI") |
| 1511 | }() | 1528 | }() |
| 1512 | | 1529 | |