You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TL;DR — missing routePrefix causes OAuth code is always verified against user's personal Apify account, even if user is logged in organization.
Repro
apify login with an organization token
apify create → any template → Where will the source code live? → GitHub
Open the printed link, authorize on GitHub
Result:
Info: Connect your github account to Apify: https://github.com/login/oauth/authorize?client_id=...
Info: Waiting for authorization to complete in your browser...
The browser tab does nothing visible. The CLI polls for 3 minutes, then stops with notAuthorized.
GET /v2/integrations/git reports GitHub only when the authenticated user has the GitHub App authorized. With an organization token, that is the organization user.
The Console callback page verifies the OAuth code against whichever Apify account the browser session resolves to, which depends on a routePrefix query parameter in the redirect URI. Console adds routePrefix=/organization/<id> when it is in an organization context. The CLI does not send it, so the code is always verified against the personal account.
Evidence, with an organization login, after a completed GitHub authorization:
$ apify api integrations/git
{ "data": [] }
Bugs
No routePrefix in the redirect URI — getGitConnectUrl in src/lib/git-source/gitSource.ts. An organization login cannot be connected from the CLI at all.
No feedback on the callback page — the page is built for Console's popup flow: it verifies, then calls window.close(). Opened as a normal tab by open(), window.close() is a no-op, so success and failure look the same, and nothing states which Apify account was connected.
The poll cannot ask for the app install — the wait loop only exits on workspaces.length. An integration that appears mid-poll with zero workspaces (authorized, but the GitHub App installed nowhere) keeps polling to the timeout, instead of switching to the install URL the CLI already knows.
Proposed fix
Send routePrefix=%2Forganization%2F<id> in the redirect URI when auth.json has organizationOwnerUserId (the CLI already checks this in src/commands/actors/push.ts).
Name the target Apify account in the Waiting for authorization... line.
Re-evaluate the stop condition on every poll, so a 0-workspace integration opens the install URL instead of waiting out the timeout.
Warn when the authorization lands on a different account than the CLI token, instead of timing out silently.
Important
TL;DR — missing
routePrefixcauses OAuth code is always verified against user's personal Apify account, even if user is logged in organization.Repro
apify loginwith an organization tokenapify create→ any template → Where will the source code live? → GitHubResult:
The browser tab does nothing visible. The CLI polls for 3 minutes, then stops with
notAuthorized.Seen on 1.9.0 (#1348), production API.
Cause
GET /v2/integrations/gitreports GitHub only when the authenticated user has the GitHub App authorized. With an organization token, that is the organization user.The Console callback page verifies the OAuth code against whichever Apify account the browser session resolves to, which depends on a
routePrefixquery parameter in the redirect URI. Console addsroutePrefix=/organization/<id>when it is in an organization context. The CLI does not send it, so the code is always verified against the personal account.Evidence, with an organization login, after a completed GitHub authorization:
Bugs
routePrefixin the redirect URI —getGitConnectUrlinsrc/lib/git-source/gitSource.ts. An organization login cannot be connected from the CLI at all.window.close(). Opened as a normal tab byopen(),window.close()is a no-op, so success and failure look the same, and nothing states which Apify account was connected.workspaces.length. An integration that appears mid-poll with zero workspaces (authorized, but the GitHub App installed nowhere) keeps polling to the timeout, instead of switching to the install URL the CLI already knows.Proposed fix
routePrefix=%2Forganization%2F<id>in the redirect URI whenauth.jsonhasorganizationOwnerUserId(the CLI already checks this insrc/commands/actors/push.ts).Waiting for authorization...line.🤖 Generated with Claude Code