Browse docs

Platform

Connect to CloudHike

Add a “Connect to CloudHike” button to your own platform. Your users sign in and click Allow; you get a token to create projects and deploy services for them.

How it works

Building an app builder, a no-code tool or an AI agent that needs a backend? Let your users bring their CloudHike.dev workspace. It works like “Sign in with GitHub”: you send the user to CloudHike.dev, they sign in and click Allow, and you get an access token. With it you call the MCP server or the REST API to create projects, deploy Postgres, Auth, Storage and more, and read the .env. Usage is billed to the user's workspace.

  1. Register your app in Settings → API & apps → Developer apps. You get a client ID and a client secret.
  2. Send the user to https://cloudhike.dev/connect?client_id=…&redirect_uri=…&state=….
  3. They sign in (or sign up) and click Allow. We redirect to your redirect_uri with ?code=…&state=….
  4. Your server exchanges the code for an access token at POST https://cloudhike.dev/api/connect/token.
  5. Call https://cloudhike.dev/api/mcp or https://cloudhike.dev/api/v1 with Authorization: Bearer <access_token>.

1. Register your app

In Settings → API & apps → Developer apps, click New app. Give it the name users see on the Allow screen and up to 5 callback URLs (https, or http on localhost for development). The redirect_uri you send must match one of them exactly. Copy the client secret when it is shown: it is only shown once. Keep it on your server.

2. Send the user to CloudHike

Text
https://cloudhike.dev/connect?client_id=cha_xxx&redirect_uri=https%3A%2F%2Fmyapp.com%2Fcloudhike%2Fcallback&state=RANDOM
ParameterDescription
client_idYour app's client ID.
redirect_uriOne of your registered callback URLs, exactly.
stateA random value you store and check on the callback, to stop forged callbacks.

On Allow we redirect to redirect_uri?code=…&state=…. On Cancel we redirect to redirect_uri?error=access_denied&state=…. The code is valid for 5 minutes and can be used once.

3. Exchange the code (server side)

Shell
curl -X POST https://cloudhike.dev/api/connect/token \
  -H "content-type: application/json" \
  -d '{
    "code": "CODE_FROM_CALLBACK",
    "redirect_uri": "https://myapp.com/cloudhike/callback",
    "client_id": "cha_xxx",
    "client_secret": "chs_xxx"
  }'
Response
JSON
{
  "access_token": "ict_...",
  "token_type": "bearer",
  "mcp_url": "https://cloudhike.dev/api/mcp",
  "api_url": "https://cloudhike.dev/api/v1"
}
ErrorMeaning
invalid_request (400)A field is missing.
invalid_client (401)Unknown client ID or wrong secret.
invalid_grant (400)The code is unknown, expired, already used, or was issued for another app or redirect URI.

4. Build the backend for your user

The access token works everywhere the workspace API key does. Give it to your agent as the MCP server's bearer token, or call the REST API directly:

Shell
# Create a project
curl -X POST https://cloudhike.dev/api/v1/projects \
  -H "authorization: Bearer ict_..." -H "content-type: application/json" \
  -d '{"name":"My mobile app"}'

# Add services, then read the .env to put into the generated app
curl -X POST https://cloudhike.dev/api/v1/projects/PROJECT_ID/services -H "authorization: Bearer ict_..." ...
curl https://cloudhike.dev/api/v1/projects/PROJECT_ID/env -H "authorization: Bearer ict_..."

Each app has its own token per user. Connecting again replaces it. The user can disconnect your app at any time in Settings → API & apps → Connected apps; the token then returns 401 and you send them through /connect again.

Use with AI

Ask your AI editor to add a “Connect to CloudHike” button to your platform.

  1. 1

    Open a terminal in your app's folder and start Claude Code.

    Terminal
    Shell
    claude
  2. 2

    Paste the prompt below and press Enter. Approve the file edits and commands it asks about.

  3. 3

    Optional: save a short note about CloudHike.dev in CLAUDE.md so every session knows about it.

PROMPT
Add a “Connect to CloudHike” flow to this app following https://cloudhike.dev/docs/md/connect: a button that opens /connect with my client_id, a callback route that checks state and exchanges the code server-side at /api/connect/token, and store the access token per user to call https://cloudhike.dev/api/mcp.

Replace the placeholders in <angle brackets> before sending. Always review what the agent changes.