Summary
WorkOS Emulate does not implement this endpoint:
POST /authkit/oauth2/complete
This endpoint is the final step in a Standalone Connect login. Without it, an application cannot test the complete login flow against the emulator.
How the flow is supposed to work
- AuthKit starts an OAuth login.
- AuthKit sends the user to our application with a temporary
external_auth_id.
- Our application signs the user in.
- Our backend sends the user and the
external_auth_id to POST /authkit/oauth2/complete.
- WorkOS returns a
redirect_uri.
- The browser follows that URL and finishes the OAuth login.
Step 4 does not work with WorkOS Emulate because the endpoint is missing.
What happens in the emulator
The emulator has no route for POST /authkit/oauth2/complete. The request therefore reaches its normal “route not found” handler and returns:
{"message":"Not Found","code":"not_found"}
with HTTP status 404.
This is confusing for a client because WorkOS can also return a 404 when an external_auth_id is invalid or expired. Our application therefore treats the emulator's “endpoint does not exist” response as “this login has expired” and asks the user to restart.
The endpoint is present in the WorkOS OpenAPI specification, but I could not find a matching implementation in the emulator's route files.
The generated SUPPORTED.md table reports partial coverage for Applications, but it does not name Standalone Connect or this missing endpoint directly.
Reproduction with v0.13.0
Start the emulator:
npx @workos/emulate@0.13.0 --port 4100
In another terminal, call the missing endpoint:
curl -s -w "\nHTTP %{http_code}\n" \
-X POST http://localhost:4100/authkit/oauth2/complete \
-H "Authorization: Bearer sk_test_default" \
-H "Content-Type: application/json" \
-d '{"external_auth_id":"ext_auth_01HXYZ123456789ABCDEFGHIJ","user":{"id":"user_12345","email":"marcelina.davis@example.com"}}'
Result:
{"message":"Not Found","code":"not_found"}
HTTP 404
As a control, GET /organizations returns 200 when called with the same API key. This confirms that the emulator is running and the key is valid.
Expected behavior
The real WorkOS endpoint accepts:
{
"external_auth_id": "...",
"user": {
"id": "...",
"email": "..."
}
}
On success, it creates or updates the AuthKit user and returns:
{
"redirect_uri": "..."
}
Important error cases are:
- Reusing an
external_auth_id that already completed → 400 external_auth_session_already_completed
- Using an unknown or expired
external_auth_id → 404
These cases are important because clients must decide whether to retry the request or restart the entire login.
Request
Please implement POST /authkit/oauth2/complete in the emulator.
The most complete implementation would also make the authorize flow create an external_auth_id, then require that ID when the completion endpoint is called.
Is this endpoint intentionally outside the emulator's current scope, or has it simply not been implemented yet?
Environment
@workos/emulate 0.13.0 · @workos-inc/node 8.13.0 · Node 22.22.2
If this is something you would be open to, I would be happy to submit a PR.
Summary
WorkOS Emulate does not implement this endpoint:
This endpoint is the final step in a Standalone Connect login. Without it, an application cannot test the complete login flow against the emulator.
How the flow is supposed to work
external_auth_id.external_auth_idtoPOST /authkit/oauth2/complete.redirect_uri.Step 4 does not work with WorkOS Emulate because the endpoint is missing.
What happens in the emulator
The emulator has no route for
POST /authkit/oauth2/complete. The request therefore reaches its normal “route not found” handler and returns:{"message":"Not Found","code":"not_found"}with HTTP status
404.This is confusing for a client because WorkOS can also return a 404 when an
external_auth_idis invalid or expired. Our application therefore treats the emulator's “endpoint does not exist” response as “this login has expired” and asks the user to restart.The endpoint is present in the WorkOS OpenAPI specification, but I could not find a matching implementation in the emulator's route files.
The generated
SUPPORTED.mdtable reports partial coverage for Applications, but it does not name Standalone Connect or this missing endpoint directly.Reproduction with v0.13.0
Start the emulator:
In another terminal, call the missing endpoint:
Result:
As a control,
GET /organizationsreturns200when called with the same API key. This confirms that the emulator is running and the key is valid.Expected behavior
The real WorkOS endpoint accepts:
{ "external_auth_id": "...", "user": { "id": "...", "email": "..." } }On success, it creates or updates the AuthKit user and returns:
{ "redirect_uri": "..." }Important error cases are:
external_auth_idthat already completed →400 external_auth_session_already_completedexternal_auth_id→404These cases are important because clients must decide whether to retry the request or restart the entire login.
Request
Please implement
POST /authkit/oauth2/completein the emulator.The most complete implementation would also make the authorize flow create an
external_auth_id, then require that ID when the completion endpoint is called.Is this endpoint intentionally outside the emulator's current scope, or has it simply not been implemented yet?
Environment
@workos/emulate0.13.0 ·@workos-inc/node8.13.0 · Node 22.22.2If this is something you would be open to, I would be happy to submit a PR.