OAuth deploy flow failing on project token creation
meetz016
FREEOP

a month ago

We have an OAuth-based deployment flow that previously worked but now fails when creating a project token.

GraphQL endpoint:

https://backboard.railway.com/graphql/v2

Granted OAuth scopes:

  • openid
  • email
  • profile
  • offline_access
  • workspace:admin

Deployment flow (GraphQL operations):

  1. me
  2. projectCreate
  3. serviceCreate
  4. project
  5. serviceDomainCreate
  6. variableCollectionUpsert
  7. projectTokenCreate
  8. railway up

The OAuth access token successfully executes every GraphQL operation through variableCollectionUpsert. The failure only occurs when calling projectTokenCreate.

mutation projectTokenCreate($input: ProjectTokenCreateInput!) {
  projectTokenCreate(input: $input)
}

Payload:

{
  "input": {
    "projectId": "project-id",
    "environmentId": "environment-id",
    "name": "app-deploy"
  }
}

Response:

Error: Railway GraphQL error: Not Authorized

The returned project token is used to deploy with:

RAILWAY_TOKEN=<token> railway up \
  --project <project-id> \
  --service <service-id> \
  --environment <environment-id> \
  --detach

Is projectTokenCreate still expected to work with a workspace:admin OAuth token, or has the supported deployment flow for OAuth apps changed? If it has changed, what is the recommended deployment flow for applications deploying on behalf of a user?

Solved

1 Replies

Status changed to Awaiting Railway Response Railway about 1 month ago


Railway
BOT

a month ago

projectTokenCreate is intentionally blocked for OAuth tokens, regardless of scope. A project token is a long-lived credential that would outlive the OAuth grant that created it (revoking the OAuth app would not delete the project token), so this is a deliberate security boundary. The recommended alternative is to call serviceInstanceDeployV2 directly with your OAuth access token as the Bearer token, which works with workspace:member scope or higher and returns a deployment ID you can poll.


Status changed to Awaiting User Response Railway about 1 month ago


Railway
BOT

a month ago

This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!

Status changed to Solved Railway about 1 month ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...