diff --git a/cmd/cloud/setup.go b/cmd/cloud/setup.go index 0fbc0d6aa..ff1cd360b 100644 --- a/cmd/cloud/setup.go +++ b/cmd/cloud/setup.go @@ -396,7 +396,16 @@ func checkAPIToken(isDeploymentFile bool, args []string) (bool, error) { } workspaceID = strings.Replace(claims.Permissions[1], "workspaceId:", "", 1) orgID := strings.Replace(claims.Permissions[2], "organizationId:", "", 1) - orgShortName := strings.Replace(claims.Permissions[3], "orgShortNameId:", "", 1) + orgShortName := strings.Replace(claims.Permissions[3], "orgShortName:", "", 1) + + orgs, err := organization.ListOrganizations(coreClient) + if err != nil { + return false, err + } + + org := orgs[0] + orgProduct := fmt.Sprintf("%s", *org.Product) //nolint + // If using api keys for virtual runtimes, we dont need to look up for this endpoint if !(len(args) > 0 && strings.HasPrefix(args[0], "vr-")) { err := c.SetContextKey("workspace", workspaceID) // c.Workspace diff --git a/cmd/cloud/setup_test.go b/cmd/cloud/setup_test.go index 4368cc96a..84295d6e0 100644 --- a/cmd/cloud/setup_test.go +++ b/cmd/cloud/setup_test.go @@ -344,7 +344,7 @@ func TestCheckAPIToken(t *testing.T) { "", "workspaceId:workspace-id", "organizationId:org-ID", - "orgShortNameId:org-short-name", + "orgShortName:org-short-name", } mockClaims := util.CustomClaims{ Permissions: permissions,