Skip to content

Add Autodesk Platform Services (APS) OAuth emulator - #201

Open
mrestrepoj10 wants to merge 3 commits into
vercel-labs:mainfrom
mrestrepoj10:add-aps-oauth-emulator
Open

Add Autodesk Platform Services (APS) OAuth emulator#201
mrestrepoj10 wants to merge 3 commits into
vercel-labs:mainfrom
mrestrepoj10:add-aps-oauth-emulator

Conversation

@mrestrepoj10

@mrestrepoj10 mrestrepoj10 commented Aug 13, 2026

Copy link
Copy Markdown

Adds @emulators/aps, a stateful emulator for the Autodesk Platform Services OAuth v2 API (the authentication layer for Autodesk Construction Cloud, BIM 360, Fusion, and every other APS product). This is the first AEC (architecture, engineering, construction) service in emulate; the plan is to follow with the APS data APIs (Data Management, Model Derivative) based on interest, and a Procore emulator after that.

What it emulates

All endpoints at their real developer.api.autodesk.com paths:

  • GET /authentication/v2/authorize with the shared sign-in UI, PKCE (S256 only, required for public clients), and spec-accurate error redirects
  • POST /authentication/v2/token for authorization_code, client_credentials, and refresh_token
  • POST /authentication/v2/revoke, POST /authentication/v2/introspect
  • GET /authentication/v2/keys (JWKS), GET /authentication/v2/logout
  • GET /userinfo (real APS serves this from api.userprofile.autodesk.com; mapped onto the emulator base URL)
  • GET /.well-known/openid-configuration

Access tokens are RS256 JWTs carrying the documented claims (scope as array, client_id, real APS iss/aud, userid on 3-legged) and verify against the JWKS endpoint. Lifetimes follow the docs: codes 5 minutes single-use, access tokens expires_in: 3599, refresh tokens 15 days.

Fidelity note: single-use refresh tokens

APS rotates refresh tokens on every use and invalidates the previous one; replaying a consumed token kills the grant. This is the number-one production failure mode for APS integrations (two serverless instances refreshing concurrently brick the user's connection), and it is faithfully emulated including grant-family invalidation on replay, so integration tests can exercise the failure locally instead of discovering it in production.

Implementation

  • Built against the official APS OAuth v2 documentation (HTTP reference plus developer guide), with response bodies and error shapes matching the documented examples, including the platform error format (developerMessage, errorCode, "more info").
  • Follows the existing package patterns throughout: mirrors @emulators/okta for structure, jose for signing, the shared UI system from @emulators/core for the sign-in and error pages, seedable and resettable stores.
  • Zero-config defaults (confidential client aps-test-client/aps-test-secret, public client aps-test-app, user testuser@autodesk.local) so npx emulate --service aps works immediately.
  • 54 tests covering the three flows, PKCE enforcement, rotation and replay (family invalidation), introspection, revocation, JWKS verification of issued tokens, userinfo, discovery, and the documented error shapes.
  • Docs updated per AGENTS.md: root README, config example, package README, skills/aps, and the web docs pages and navigation.

Not included (yet)

APS data APIs (Data Management hubs/projects, Model Derivative) and rate-limit emulation. Kept out to keep this PR reviewable; happy to follow up based on interest.

Stateful emulation of the APS OAuth v2 API at its real paths: authorize
with PKCE (S256), token for all three grant types, revoke, introspect,
JWKS, logout, userinfo, and OIDC discovery. Access tokens are RS256 JWTs
with the documented claims; refresh tokens are single use and rotate,
with grant-family invalidation on replay, matching production APS.

Includes seed config, zero-config defaults, 54 tests, package README,
agent skill, web docs page, and registry/docs listings (also restores
Twilio in the docs navigation lists it was missing from).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016Rg8ZpxU5NAYMUCCpgamFq
@vercel

vercel Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

@mrestrepoj10 is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

…lient

The zero-config confidential client already covered the Auth.js callback
path; Better Auth's genericOAuth plugin uses /api/auth/oauth2/callback/:id,
so both mainstream auth libraries now work against the emulator without a
seed file.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016Rg8ZpxU5NAYMUCCpgamFq
Keeps the generated starter config and every seed example consistent
with the sample client's registered redirect URIs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016Rg8ZpxU5NAYMUCCpgamFq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant