Skip to content
Reading with an AI assistant?View as MarkdownOpen in ClaudeOpen in ChatGPT

Guides

SkedCast OAuth 2.1: connect an app

Updated

SkedCast OAuth 2.1 lets an app act for a SkedCast user without seeing their password: register, send the user to consent with a PKCE challenge, exchange the code for tokens, then call the API as that user.

Browse docs

How does SkedCast OAuth work?#

SkedCast OAuth is the authorization code flow with PKCE (RFC 7636): your app holds no password or client secret, and the user approves your scopes on a consent screen.

For your own scripts use an API key instead: no redirect, no refresh (authentication). Make a first request with the 5-minute quickstart.

  • Public clients only: PKCE with S256 is mandatory and there is no client secret to store.
  • A redirect URI that is https, or an http loopback URL (127.0.0.1, localhost or [::1]) for a native or command-line client. Anything else is rejected at registration.
  • Scopes chosen: a token's power is its scopes intersected with the user's role (scopes).
  • One token family per user and workspace; never share a token between users.
  • API keys and the REST API are included from Studio, and MCP access for AI clients from Solo. See the pricing page for the current plans.

Endpoints#

Endpoints
MethodPathPurpose
GET/.well-known/oauth-authorization-serverAS metadata (RFC 8414)
GET/.well-known/oauth-protected-resource/v1REST API resource metadata (RFC 9728): resource, authorization_servers, scopes_supported, bearer_methods_supported
GET/.well-known/oauth-protected-resource/mcpMCP resource metadata (RFC 9728), also served at /.well-known/oauth-protected-resource
GET/.well-known/jwks.jsonPublic keys for token verification
POST/oauth/registerDynamic client registration (RFC 7591)
GET/PUT/DELETE/oauth/register/:idManage a registration (RFC 7592)
GET/oauth/authorizeAuthorization endpoint (PKCE)
POST/oauth/tokenExchange code / refresh for an access token
POST/oauth/revokeRevoke a refresh token and its rotation family (RFC 7009), always 200

Every endpoint is listed in the metadata document; read the paths from it instead of hard-coding them.

Server capabilities#

  • Grants: authorization_code with PKCE (S256 only) and refresh_token. No client-credentials, device, JWT-bearer or token-exchange grant, and no introspection endpoint.
  • Public clients only: token_endpoint_auth_methods_supported is none.
  • Authorization responses carry the iss parameter (RFC 9207).
  • A client_id can be the HTTPS URL of a Client ID Metadata Document instead of a registered id.
  • A request without a token answers 401 with WWW-Authenticate: Bearer resource_metadata="…"; a token without the needed scope answers 403 insufficient_scope.

OAuth 2.1 versus 2.0#

OAuth 2.1 consolidates OAuth 2.0 and the security advice written since. It is still an Internet-Draft: draft-ietf-oauth-v2-1-17 is an Active Internet-Draft that expires on 4 May 2027 (IETF, read 22 November 2026).

RFC 9700 says refresh tokens for public clients must be sender-constrained or rotate (IETF RFC 9700, read 22 November 2026). The client is often an app or hosted AI agent that cannot keep a secret.

Table
OAuth 2.1 changeWhat the draft saysWhat SkedCast does
PKCE on the code grantThe authorization code grant requires the PKCE parametersRequired on every authorization request, and only S256 is accepted
PKCE plain methodRemovedRefused: there is no plain option
Implicit grantLeft outNot offered: the grants are authorization_code and refresh_token
Password grantLeft outNot offered
Redirect URIsCompared by exact string matchingMatched exactly; registration accepts an https URL or a loopback http URL only
Public clientsRefresh tokens one-time-use or sender-constrainedPublic clients only. Refresh tokens rotate on every use, and reusing a spent one revokes the whole chain
Bearer token in the URLNot used in the query stringSend the token in the Authorization header

The draft's list of changes is from draft-ietf-oauth-v2-1-17, read 22 November 2026. The right-hand column is what the SkedCast authorization server enforces.

Credential lifetimes#

Credential lifetimes
CredentialLifetimeRule
Authorization code10 minutesWorks once; a second exchange fails with invalid_grant
Access token15 minutesBearer; audience-bound
Refresh token30 daysRotates on every use
PKCE verifierOne authorization43 to 128 characters
Default scopeRead-onlyWhen scope is omitted

The PKCE verifier length is set by RFC 7636, section 4.1; the rest is how SkedCast issues tokens.

Diagram: the app registers and sends the user to authorize, the user consents, the app exchanges the code and its PKCE verifier for tokens, and then calls the API, refreshing and revoking as needed.
The SkedCast OAuth flow, in four steps.

Connect an app, step by step#

Eight steps, from discovery to a revoked session.

1. Discover the authorization server#

A 401 from the REST API points at the resource metadata, which names the authorization server and its own metadata (RFC 8414, RFC 9728). A client that follows them never types an OAuth URL.

bash
# 1. Call the API with no token and read the challenge
curl -i https://api.skedcast.com/v1/agency

# 2. Read the REST API resource metadata named in WWW-Authenticate
curl https://api.skedcast.com/.well-known/oauth-protected-resource/v1

# 3. Read the authorization server metadata it points to
curl https://api.skedcast.com/.well-known/oauth-authorization-server
Read the challenge, then the two metadata documents.
http
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer error="invalid_token", error_description="The access token is invalid or expired", resource_metadata="https://api.skedcast.com/.well-known/oauth-protected-resource/v1"
The challenge on a rejected token names where to sign in again.

2. Register your client (DCR)#

Register once (RFC 7591) to get a client_id. Keep the registration_access_token to update or delete the registration (RFC 7592). Or use the HTTPS URL of a Client ID Metadata Document as the client_id, with nothing to register.

  • redirect_uri is https, or http on loopback for a native or command-line client; anything else is refused with invalid_redirect_uri.
  • A loopback redirect matches on any port (RFC 8252 §7.3), so register it without one.
  • Redirect URIs are matched exactly at sign-in.
bash
curl -X POST https://api.skedcast.com/oauth/register \
  -H "Content-Type: application/json" \
  -d '{
    "client_name": "My App",
    "redirect_uris": ["https://myapp.com/oauth/callback"],
    "scope": "posts.read posts.compose"
  }'
redirect_uris must be https (or http loopback for native / CLI clients).
json
{
  "client_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
  "client_id_issued_at": 1751299200,
  "client_name": "My App",
  "redirect_uris": ["https://myapp.com/oauth/callback"],
  "grant_types": ["authorization_code", "refresh_token"],
  "response_types": ["code"],
  "token_endpoint_auth_method": "none",
  "scope": "posts.read posts.compose",
  "registration_access_token": "reg_…",
  "registration_client_uri": "https://api.skedcast.com/oauth/register/f47ac10b-…"
}
Response (RFC 7591 §3.2.1) — keep client_id; the rest is echoed back. A field with no value, such as scope when you registered none, is omitted — never null.

3. Generate a PKCE pair#

Per authorization, create a code_verifier of 43 to 128 characters and its S256 code_challenge (RFC 7636). Keep the verifier private; put the challenge in the authorize URL. plain is refused.

ts
import { randomBytes, createHash } from "node:crypto";

// code_verifier: 43-128 unreserved chars (RFC 7636 §4.1)
const codeVerifier = randomBytes(32).toString("base64url");

// code_challenge = base64url(SHA-256(verifier)) (RFC 7636 §4.2)
const codeChallenge = createHash("sha256")
  .update(codeVerifier)
  .digest("base64url");
PKCE (Node) — verifier stays server-side, challenge goes in the URL.

4. Send the user to authorize#

Redirect the browser to /oauth/authorize. The user signs in and consents, and SkedCast redirects back to your redirect_uri with ?code=…&state=…&iss=…; an error comes back the same way.

  • Verify state matches what you sent, and iss equals the issuer in the metadata (RFC 9207).
  • Ask for the fewest scopes the feature needs; the user sees them in plain words. With none named, the token gets the default read-only scopes.
  • Send resource to pick the audience (RFC 8707). It is fixed at this step; repeat it at the token step, where a mismatch is invalid_target.

Resource values#

Resource values
You want to callSend resource=Accepted by
The REST APIhttps://api.skedcast.com/v1Routes under /v1 only
The MCP serverhttps://api.skedcast.com/mcpThe MCP server only (the default when resource is omitted)

A token locked to one resource is useless on the other. Tokens are signed with RS256 and the API checks signature, issuer and audience on every call.

http
GET https://api.skedcast.com/oauth/authorize
  ?response_type=code
  &client_id=f47ac10b-…
  &redirect_uri=https://myapp.com/oauth/callback
  &scope=posts.read%20posts.compose
  &state=<random-csrf-token>
  &code_challenge=<codeChallenge>
  &code_challenge_method=S256
  &resource=https://api.skedcast.com/v1
The authorize URL (line-wrapped for readability).

5. Exchange the code for tokens#

POST the code with your code_verifier and the same resource. SkedCast verifies the PKCE challenge and returns an access and a refresh token. The code is valid for 10 minutes and works once.

bash
curl -X POST https://api.skedcast.com/oauth/token \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d grant_type=authorization_code \
  -d code=<authorization_code> \
  -d redirect_uri=https://myapp.com/oauth/callback \
  -d client_id=f47ac10b-… \
  -d code_verifier=<codeVerifier> \
  -d resource=https://api.skedcast.com/v1
json
{
  "access_token": "eyJ…",
  "token_type": "Bearer",
  "expires_in": 900,
  "scope": "posts.read posts.compose",
  "refresh_token": "eyJ…"
}
Token response.

6. Call the API with the token#

Send the access token as a Bearer credential, exactly like an API key. Its power is scopes ∩ the user's role (scopes), and it must have been issued for the REST API (conventions).

bash
curl https://api.skedcast.com/v1/agency \
  -H "Authorization: Bearer eyJ…"

7. Refresh an expired access token#

Refresh before the 15 minutes end, or when a call returns 401. The new pair keeps the original resource and is re-checked against the person's current access, so scopes may narrow after a demotion.

bash
curl -X POST https://api.skedcast.com/oauth/token \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d grant_type=refresh_token \
  -d refresh_token=eyJ… \
  -d client_id=f47ac10b-…

8. Revoke access on logout#

Revoke the refresh token (RFC 7009) when the user disconnects: it ends the whole rotation family. The endpoint always returns 200, even for an unknown token. Access tokens are not revoked one by one; they expire within 15 minutes.

bash
curl -X POST https://api.skedcast.com/oauth/revoke \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d token=eyJ…

Errors#

The /oauth/* endpoints return { "error": "invalid_grant", "error_description": "…" } as application/json with a 4xx status, not the /v1 problem+json. Branch on error.

Table
CodeMeaning
invalid_requestThe request is malformed
invalid_clientAn unknown or blocked client_id
invalid_grantA code or refresh token that is spent, expired or issued for another redirect URI
invalid_targetA resource that does not match the one sent at the authorize step
unsupported_grant_typeA grant SkedCast does not implement
invalid_scope, unsupported_response_typeBoth are returned through the authorize redirect
invalid_client_metadataA registration whose grant_types leave no authorization_code, or whose response_types leave no code; other unsupported values are dropped, not refused

Errors for /v1 calls live in the API error catalogue.

Troubleshoot#

Troubleshoot
SymptomCauseFix
invalid_grant at the token stepA code already used, expired after ten minutes or issued for another redirect URIStart a new authorization. Log the error and description, never the code or tokens
Many refreshes fail at onceTwo workers refreshed the same token, or an older copy overwrote the stored refresh tokenOne refresher per grant; store the newest refresh token
Authorize request refusedplain PKCE, or a redirect URI that differs by a slash or portSend code_challenge_method=S256 and the exact registered string
Token 401s on /v1The token was issued for the MCP server, the default when resource is omittedRequest resource for the REST API
Redirect comes back with an error, not a codeThe user denied consentTreat it as a normal outcome; keep the user signed in to your app and offer the connection later
Refresh fails after a whileThe grant was revoked, or the user left the workspace; SkedCast re-reads access on every request, so Disconnect in Settings → Connected apps takes effect at onceStart the authorize step again; the user authorizes again if they join a different workspace

The error catalogue lists every /v1 code.

Verify the integration#

  • Call GET /v1/agency with the token: 200 means it is valid and allowed to read the workspace.
  • Test refresh before you ship: after 15 minutes, confirm the app refreshes, stores the new refresh token and retries once.
  • Reuse an old refresh token on purpose in a test workspace to see the family revoked.
  • In development, register a loopback redirect such as http://127.0.0.1, authorize in your browser and print the token response, using a test workspace.

Security checklist#

  • Send a random state and check it on return, so a forged callback is rejected.
  • Check that iss equals the issuer in the metadata; it defends against mix-up attacks (RFC 9207).
  • Keep the code_verifier on your server and use a new pair for every authorization.
  • Store tokens on your server, encrypted at rest, never in browser storage or logs. The access token can live in memory.
  • Store the newest refresh token after every refresh, with the user it belongs to, and never reuse an old one.
  • Update a registration with its registration_access_token (RFC 7592) instead of registering a new client for every change.
  • Record the client id, user or workspace, scopes, time and outcome of each authorize, token and refresh call. Never log codes, tokens or the PKCE verifier.
  • Revoke the refresh token when the user disconnects.

Pages for what an OAuth token can do.

Sources#

All read 21 November 2026, except RFC 9700 and RFC 9728 (read 22 November 2026). Token lifetimes, the code lifetime and the default scope are how the SkedCast API issues tokens. Next review: 21 February 2027.