OAuth, sessions and revocation
Keep issuer, audience, client and consent boundaries explicit throughout a token's lifecycle.
Discover a trusted issuer
Read the configured issuer's OpenID configuration or OAuth authorization-server metadata, then compare the returned issuer exactly before trusting signing keys or protocol endpoints. Public clients use S256 PKCE and exact registered redirect URIs. Request the intended resource on both authorization and token calls.
Resource registry enforcement is a staged operator cutover: AUTH_SERVICE_RESOURCE_GRANTS_ENFORCED defaults off. Inventory existing clients, propose and review their exact resources/scopes, reconcile approved scope ceilings and migrate clients before enabling enforcement. An approved registry row records operator review; it is not automated DNS or HTTPS domain-ownership proof. Your API must still verify tokens and enforce application permissions.
Propose an API resource for review
Use the customer console’s API resources page or these server-side SaaS SDK helpers. A proposal contains only directory_id, resource_uri and proposed_scopes. The directory identifier may be its raw UUID or the existing typed Node ID; preserve it unchanged. GET lists at most 100 rows, with an optional after cursor containing the last raw registration UUID.
No customer approval helper is exposed. Read status, approved_scopes, public_clients and review fields from the returned record. Proposal submission is not approval, and approval is not automatic DNS/HTTPS ownership proof. These customer-management calls require an approved management credential and the correct workspace role; a token issued solely to your application API is not management authority.
TypeScript · typescript
import { SaasClient } from "@beyondigital/auth-sdk";
const saas = new SaasClient({ issuerUrl: "https://auth.example.com" });
const proposal = await saas.proposeResource(accessToken, accountId, {
directory_id: "DIRECTORY_NODE_ID_FROM_CONSOLE",
resource_uri: "https://api.example.com/v1",
proposed_scopes: ["documents:read"]
});
// Submission grants no access. Inspect service-reported review state.
const page = await saas.listResources(accessToken, accountId);
const last = page.at(-1);
if (page.length === 100 && last) {
const nextPage = await saas.listResources(accessToken, accountId, last.id);
}Python · python
from beyondigital_auth import AsyncSaasClient, ResourceProposal
async def propose_for_review(client: AsyncSaasClient, access_token: str,
account_id: str, directory_id: str):
return await client.propose_resource(access_token, account_id,
ResourceProposal(directory_id=directory_id,
resource_uri="https://api.example.com/v1",
proposed_scopes=["documents:read"]))Rust · rust
use beyondigital_auth_sdk::{AuthError, ResourceProposal, ResourceRegistration, SaasClient};
pub async fn propose_for_review(client: &SaasClient, access_token: &str,
account_id: &str, directory_id: &str) -> Result<ResourceRegistration, AuthError> {
client.propose_resource(access_token, account_id, &ResourceProposal {
directory_id: directory_id.into(),
resource_uri: "https://api.example.com/v1".into(),
proposed_scopes: vec!["documents:read".into()],
}).await
}Refresh once and store the replacement
Refresh tokens rotate. Persist the returned replacement before the next request; a reused token can invalidate its family. Coordinate concurrent browser refreshes and do not automatically replay a code exchange or a consequential mutation after an uncertain network response.
A resource server validates at+jwt access-token purpose, signature, expiry, issuer, audience and required permissions. ID tokens are for the client, not API authorization. Pairwise subjects cannot be correlated across clients.
Hosted primary passkey login
POST /hosted/webauthn/login/start accepts {client_id}. POST /hosted/webauthn/login/finish accepts {client_id,ceremony_id,credential} and the browser-only nonce cookie. The issuer-hosted sign-in page owns this ceremony for an existing user.
A successful finish establishes the hosted session and returns the fixed continue_to: /hosted/security. It returns no OAuth tokens and creates no customer-console or CRM/BFF session. Complete the registered OAuth code flow for application access. Keep account recovery and session-bound management step-up separate; do not move this ceremony into unrelated console JavaScript.
Identify the client during revocation
POST /oauth/revoke uses the client's registered authentication method. SDK revoke methods now supply client identification or Basic/Post authentication. An unknown or foreign token returns the same successful no-op response. Service-side checks and refresh are revoked immediately; an offline JWT verifier may accept an existing access token until expiry.
Public client · http
POST /oauth/revoke
Content-Type: application/x-www-form-urlencoded
client_id=your-public-client&token=TOKENConfidential server · typescript
import { BeyondigitalAuthClient } from "@beyondigital/auth-sdk";
const client = new BeyondigitalAuthClient({ issuerUrl: "https://auth.example.com",
clientId: process.env.CLIENT_ID, clientSecret: process.env.CLIENT_SECRET,
tokenEndpointAuthMethod: "client_secret_basic" });
await client.revoke(token);