OAuth 2.1
Use OAuth when your app acts on behalf of a user. The user approves the exact permissions you ask for, and your app receives a temporary access token. Your app never sees the user's password — they sign in on Telebroad's own screen, not in your app — and it never gets more access than that user already has.
It uses the standard authorization-code flow with PKCE — PKCE is a step that proves a request really came from your app. There is no client secret (a shared password between your app and Telebroad); your app is a "public client," and PKCE takes the secret's place.
At a glance, here is what you are working with:
| Base URL | https://api.account.telebroad.com |
| Discovery | /.well-known/oauth-authorization-server — a URL that lists the current endpoints |
| PKCE | Required (method S256) |
| Access token | Lasts about 1 hour |
| Refresh token | Changes every time you use it — always save the newest |
How it works, step by step
Here is the whole process, start to finish — steps 1–2 are one-time setup, and steps 3–5 happen for each user who connects.
- Add your app: your company's admin does this once.
- Discover the endpoints, once.
- Authorize: send the user to consent.
- Exchange the code for tokens.
- Refresh when the access token expires.
1. Add your app
Your company's admin adds the app once. They open Add your app, then enter:
- the app's name,
- the exact https callback URL(s), and
- who can use it: everyone, or chosen roles.
When they save, copy the client_id. There is no client secret and none is ever
issued: this is a public client, and PKCE is what proves the request came from you.
Rules that catch people out:
httpsonly, on a real domain. Nohttp, nolocalhost, no IP address, no wildcard, no#fragment and no desktop-app scheme. See why a callback URL is rejected.- The match is exact, on the full URL. At authorize time your
redirect_urimust be character-for-character one of the saved callback URLs. A trailing slash or anhttp/httpsswap is a callback URL that isn't one of the app's URLs. - One app per company. Two companies can use the same callback URL, each with
its own
client_id. If you serve several customers, each customer adds your app and gives you theirclient_id. - A new app starts with owners only. The admin chooses who else can use it, see Let your staff use an app.
If someone signs in before the app is added, they see This app isn't set up for your company.
2. Discover
curl https://api.account.telebroad.com/.well-known/oauth-authorization-server
This returns the current URLs you need for the other steps — the
authorization_endpoint, token_endpoint, and registration_endpoint — plus
scopes_supported (the list of scopes you are allowed to ask for).
The URLs shown below are what discovery returns today, and they are the one part
of the platform that does not live under /api/public/v1. Read them from the
discovery response each time your app runs, instead of hard-coding them — then if
they ever move, your app keeps working with no change.
3. Authorize
PKCE ties the token exchange to your app, so a stolen authorization code is useless to anyone else — only the app that started the flow can redeem it. Create a fresh PKCE pair each time you start the flow for a user:
code_verifier = base64url(32 random bytes) # secret, keep server-side
code_challenge = base64url( SHA-256(code_verifier) ) # goes in the URL
Any language works the same way — use its secure-random, SHA-256, and base64url functions.
Where each value goes: the code_challenge goes in the authorize URL (step 3, just
below); the code_verifier goes in the token request (step 4).
Send the user's browser to the authorization_endpoint (Telebroad's approval
screen, from the Discover step):
{authorization_endpoint}
?response_type=code
&client_id=tbapp_…
&redirect_uri=https://app.acme.example/oauth/callback
&scope=webhooks:read%20webhooks:write
&state=RANDOM_PER_SESSION
&code_challenge=CHALLENGE
&code_challenge_method=S256
Here RANDOM_PER_SESSION is a placeholder — replace it with your own random
state value, which you generate fresh for each sign-in and store so you can
compare it when the user returns. (CHALLENGE is likewise a placeholder, for the
code_challenge you made above.)
The user is sent back to redirect_uri?code=…&state=…, or to
?error=access_denied if they declined. Check that the returned state matches the random state value you put in
the authorize URL above — this confirms the response belongs to the request you
started.
4. Exchange the code
Send this as form data, not JSON:
curl -X POST https://api.account.telebroad.com/api/v1/oauth/token \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d grant_type=authorization_code \
-d code=AUTHORIZATION_CODE \
-d code_verifier=CODE_VERIFIER \
-d client_id=tbapp_… \
-d redirect_uri=https://app.acme.example/oauth/callback
{
"access_token": "eyJ…",
"token_type": "Bearer",
"expires_in": 3600,
"refresh_token": "…",
"scope": "webhooks:read webhooks:write"
}
Check the scope field — it lists what the user actually granted, which may
be less than you requested in the authorize URL (step 3).
5. Refresh
curl -X POST https://api.account.telebroad.com/api/v1/oauth/token \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d grant_type=refresh_token \
-d refresh_token=REFRESH_TOKEN \
-d client_id=tbapp_…
This returns a new access token and a new refresh token. Refresh tokens change on every use — save the newest one each time, and stop using the old one. Reusing an old refresh token fails.
AI assistants and tools that register themselves
Assistants such as Claude, ChatGPT and the Telebroad Playground cannot ask an admin to add them first, so they register themselves with dynamic client registration. This is only for them. If you are building an app for a company, use Add your app.
curl -X POST https://api.account.telebroad.com/api/v1/oauth/register \
-H 'Content-Type: application/json' \
-d '{
"client_name": "Example Assistant",
"redirect_uris": ["https://assistant.example/oauth/callback"]
}'
{
"client_id": "tbmcp_…",
"redirect_uris": ["https://assistant.example/oauth/callback"]
}
Their redirect_uris must be HTTPS on a host Telebroad has approved, with one
standing exception: loopback callbacks work with no approval and no HTTPS.
A registration that is refused returns
this error.
Loopback callbacks
http://localhost:3000/callback
http://127.0.0.1:53682/callback
http://[::1]:8080/callback
localhost, 127.0.0.1 and [::1] are accepted on any port, over http, with
no approval. This is how desktop and command-line assistants connect. It does
not apply to your company's apps, which take saved https callbacks only.
This is RFC 8252 §7.3, loopback interface redirection. Any port is accepted because a native app binds whatever the OS gives it and cannot register the number in advance.
:::note Why this is safe even though anyone can register a client
The authorization code is delivered to the user's own machine. An attacker who
registered a client pointing at 127.0.0.1 would be sending the code to the
victim's loopback interface, which they cannot reach — to read it they would
already need code running on that machine, and at that point the browser session is
theirs anyway.
That is not true of an internet host, which is exactly why those are approved. :::
The exception matches the host, not a substring of it:
https://localhost.evil.example/cb is an ordinary internet host and still needs
approval.
Call the API
curl https://api.account.telebroad.com/api/public/v1/webhooks \
-H "Authorization: Bearer ACCESS_TOKEN"
Errors
| Status | Meaning | Action |
|---|---|---|
401 | Missing or expired token | Refresh, then re-authorize if that fails |
403 insufficient_scope | Token lacks the scope; the scope field names it | Re-authorize with that scope |
403 permission_denied | Scope is fine — the user's role lacks the permission | Their admin must change their role |
400 on /token | Bad or expired code, PKCE mismatch, or wrong redirect_uri | Restart the flow |
400 invalid_grant on /token | The connection, the app or the user's role was removed, or the refresh token expired | Never retry. See Handling revoked access |
| Sign-in page error | The app isn't set up, the user isn't allowed yet, or the callback URL doesn't match | See OAuth errors |
That third row — permission_denied — is the one people lose the most time on.
See Scopes.
Security requirements
- PKCE (S256) is required. There is no client secret to fall back on.
- Redirect addresses must use HTTPS and match one of your app's callback URLs exactly.
- Keep up with rotating refresh tokens — save the newest after every refresh.
- Ask for as little as possible — request only the scopes you need; a user who sees a shorter list of permissions is more likely to say yes.