OAuth Apps and Connected Apps

Let an app act on a Bot-Hosting account with its owner's consent, and stay in control of the apps you connected.

Updated Dec 1, 2026

OAuth lets an application act on a Bot-Hosting account without ever seeing its password. The user signs in on Bot-Hosting, sees exactly what the app asks for, and approves or refuses. This is how ChatGPT, Claude and other AI apps connect to the MCP server, and how you can build your own integration.

Apps you have authorized

Go to Settings, then Developer, and open Authorized apps. It lists every app you signed into with your Bot-Hosting account, the scopes you approved and the date you connected it.

Click Disconnect to cut an app off. Its tokens stop working immediately. Review this list from time to time, and disconnect anything you no longer use.

Build your own OAuth app

Register an app when you want other people to sign in with their Bot-Hosting account and let your app act on their behalf.

Register the app

  1. Go to Settings, then Developer, and open My apps.
  2. Under New OAuth app, enter an App name and your Redirect URIs (one per line).
  3. Click Create app. Your app appears in the list with its client_id and a Copy client_id button.

Bot-Hosting apps are public clients. There is no client secret. PKCE is the proof that the code belongs to your app, so your app can run in a browser, on a phone or on a desktop.

Redirect URIs follow these rules.

  • Up to 10 per app.
  • https and http addresses, or a private app scheme such as myapp://callback.
  • No fragment (#), no user name or password in the address.
  • For http on a loopback address (127.0.0.1, [::1] or localhost), any port is accepted as long as the host, path and query match a registered URI. This suits desktop and command line apps.

You can Edit the name and redirect URIs later, or Delete the app. Each app shows its connected users, and Revoke this user's access disconnects one of them.

The Login URL builder

Each app has a Login URL section. Pick the scopes to request, and it builds the authorize link for you. Your app replaces the PKCE challenge and the state placeholders with values it generates at runtime. The builder uses the app's first redirect URI.

The authorization flow

The flow is OAuth 2.1 authorization code with PKCE (S256 only).

  1. Send the user to the authorize URL

    https://bot-hosting.net/oauth/authorize
      ?response_type=code
      &client_id=bhc_your_client_id
      &redirect_uri=https://yourapp.example/callback
      &scope=deployments:read files:read
      &state=RANDOM_STATE
      &code_challenge=BASE64URL_SHA256_OF_VERIFIER
      &code_challenge_method=S256
    

    Scopes are separated by spaces. If you send no scope at all, the app asks for every public scope.

  2. The user signs in and approves

    A user who is not signed in goes through the login page first. The consent screen shows your app's name and the scopes, grouped and described. The user approves them all or refuses. Scopes cannot be ticked one by one.

  3. Receive the code

    Bot-Hosting redirects to your redirect_uri with code and your state. Check that state matches. The code is single use and expires after 10 minutes.

  4. Exchange the code for tokens

    curl -X POST https://bot-hosting.net/api/oauth/token \
      -d grant_type=authorization_code \
      -d code=THE_CODE \
      -d redirect_uri=https://yourapp.example/callback \
      -d client_id=bhc_your_client_id \
      -d code_verifier=THE_VERIFIER
    

    The body can be form encoded or JSON.

  5. Call the API

    Use the access_token as a bearer token on the REST API or the MCP server, exactly like an API key.

Tokens

Token Prefix Lifetime
Authorization code none 10 minutes, single use
Access token bho_ 7 days
Refresh token bhr_ 30 days

To get a new access token, send the refresh token to the same endpoint.

curl -X POST https://bot-hosting.net/api/oauth/token \
  -d grant_type=refresh_token \
  -d refresh_token=bhr_your_refresh_token \
  -d client_id=bhc_your_client_id

Every refresh returns a new refresh token and invalidates the old one, so always store the latest. When a user disconnects your app, or you revoke them, all their tokens stop working.

What an app can do

An app has the scopes the user approved, and works on the deployments that user can reach, with the same sharing rules as the dashboard. It can run irreversible operations, such as deleting files, within those scopes, because the user approved them on the consent screen. Ask only for the scopes your app needs.

Discovery and automatic registration

Most OAuth and MCP clients configure themselves.

  • https://bot-hosting.net/.well-known/oauth-authorization-server describes the authorize, token and registration endpoints, the supported scopes and methods.
  • https://bot-hosting.net/.well-known/oauth-protected-resource describes the API as a protected resource.
  • POST https://bot-hosting.net/api/oauth/register lets a client register itself with its redirect URIs and get a client_id (dynamic client registration).
  • A client can also use the URL of a client metadata document as its client_id.

Errors

The token endpoint answers 400 with a standard OAuth error, such as invalid_request, invalid_grant (code expired, already used, or wrong redirect_uri), invalid_client or unsupported_grant_type. On the authorize page, an unknown client or a redirect URI that does not match the registration shows an error instead of redirecting.

More detail for app builders is on the OAuth page of the website.