Allow creating the first organization via qovery api organization - #702
Merged
Conversation
GetAccessToken() calls ListOrganization() to validate the token, then rejects any qovery api call outright when the org list is empty — even when the call being made is the org-creation call itself. This makes the documented `qovery api organization --field name=... --field plan=...` example (shown in `qovery api --help`) impossible to run for a brand-new account with zero organizations, forcing a detour through the web console just to bootstrap the very first org. Add GetAccessTokenAllowNoOrg(), used only by runAPI when the request is exactly `POST /organization`, to skip that guard for this one legitimate bootstrap case. Every other `qovery api` call keeps the existing protection against operating with no organization to scope to.
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 2 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Astach
reviewed
Aug 31, 2026
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
- Per review feedback, drop the GetAccessToken()/GetAccessTokenAllowNoOrg() wrapper pair and export getAccessToken directly as GetAccessToken(skipOrgaCheck bool). Every existing call site is updated to pass false; only runAPI's org-creation path passes true. - Add utils/context_test.go: unit tests for checkOrgaValid, plus an httptest-backed end-to-end test proving GetAccessToken(false) still rejects a zero-organization account for every other command while GetAccessToken(true) allows it through for org creation only.
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 173 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
Astach
approved these changes
Aug 31, 2026
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GetAccessToken()validates the token by callingListOrganization()and hard-fails with "you don't have any organization. Please create an account on https://start.qovery.com ." whenever the list is empty — before the actual request is even sent.qovery api ...call for a brand-new account, including the org-creation call itself:qovery api organization --field name=... --field plan=..., whichqovery api --helpdocuments as a first-class example.Fix
getAccessToken(skipOrgaCheck bool), keepingGetAccessToken()behavior unchanged for every existing caller.GetAccessTokenAllowNoOrg(), used only byrunAPI(cmd/api.go) when the request is exactlyPOST /organization— the one legitimate case where having zero organizations is expected.qovery apicall (and every other command usingGetAccessToken) keeps the existing guard against operating with no organization to scope to.Test plan
go build ./cmd/... ./utils/...andgo vet ./cmd/... ./utils/...— clean (pre-existinggo vet ./...failures in unrelated packages are due to missing generated mocks, unaffected by this change)gofmt -l cmd/api.go utils/context.go— no diffqovery api organization --field name="..." --field plan=BUSINESS_2025now succeeds (200, returns the created org)qovery auth --headless(to pick up the new org's role claim in the JWT),qovery api organization(unpatched binary) lists it normally, and every other command continues to correctly reject zero-organization accounts🤖 Generated with Claude Code
Summary by cubic
Allows
qovery api organization --method POSTto create the first organization on a new account instead of failing with "you don't have any organization" before the request is sent.GetAccessToken()now takes askipOrgaCheck bool; every call site passesfalseexceptrunAPIfor the exactPOST /organizationpath andauth status, which passtrueso zero-organization accounts can create their first org and still be recognized as authenticated, while all other commands keep the guard.Written for commit 64753e3. Summary will update on new commits.