feat: add auth0 service emulator#89
Open
mvanhorn wants to merge 1 commit intovercel-labs:mainfrom
Open
Conversation
Contributor
|
@mvanhorn is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
924fcc4 to
7642cc0
Compare
| app.get("/u/login", renderAuthorize); | ||
| app.post("/u/login/callback", handleCallback); | ||
| app.get("/u/consent", (c) => { | ||
| const client = auth0.applications.findOneBy("client_id", c.req.query("client_id") ?? ""); |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an Auth0 service emulator with stateful tenant-aware OIDC discovery, Universal Login pages, PKCE auth code flow, refresh token rotation, client credentials, Userinfo, logout, and a Management API for users, roles, applications, organizations, and connections. Mirrors the existing Okta plugin's structure with Auth0-specific surface differences.
Why this matters
Auth0 is one of the two most-used hosted identity providers in the JS ecosystem. The official
@auth0/nextjs-auth0SDK has ~430K weekly npm downloads;@auth0/auth0-reacthas ~700K weekly. CI tests against Auth0 today either hit production tenants (network-bound, tenant cost, cross-test contamination) or stub at the HTTP level, which loses OIDC flow correctness, refresh token rotation semantics, and per-API audience validation.emulate's
Storeand shared OAuth helpers give us a stateful OIDC provider with the same primitives the Okta plugin uses, plus Auth0's distinct surface (tenants, organizations, connections, audience-scoped APIs).Universal Login
The login page uses the shared
core/src/ui.tsdesign system (terminal green on black, pixel font), so it inherits the same look as the other emulator UIs.Auth0 API Coverage
GET /.well-known/openid-configurationGET /.well-known/jwks.jsonGET /authorizePOST /oauth/tokenGET /userinfoGET /v2/logoutGET /api/v2/users/POSTGET /api/v2/roles/POSTGET /api/v2/applications/POSTGET /api/v2/organizations/POSTGET /api/v2/connections/POSTDistinct from Okta
The two providers share the OIDC layer but diverge on:
<tenant>.auth0.localhost), with a?tenant=<tenant>query-param fallback for callers that cannot route subdomains in CIorganizationsprimitive (org-scoped membership and role assignment)connectionslayer (database, social, enterprise) that Auth0 exposes as a configurable login sourceaudiencevalidation on/authorize, distinct from Okta's authorization-server audiencesSeed config
Default port
4012(appended at the end ofSERVICE_NAME_LISTafterclerk— no other service's port shifts).Tests
32 Vitest tests covering OIDC discovery, JWKS, PKCE flow, refresh token rotation, client_credentials, userinfo, audience validation, logout, and Management API CRUD across users / roles / applications / organizations / connections.