Repository navigation
Conversation
…the environment issuer Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
Original prompt from madison.packer
|
There was a problem hiding this comment.
✅ Devin resolved all 4 findings on 8d678e2
Fixed by Devin (4)
- Token exchange bypasses configured fetch transport
- Token exchanges ignore timeout and retry settings
- OAuth 401 responses lose error details
- Generated Connect method needs preservation
[High impact] The PR appears safe to merge; no new blocking issues were found. SummaryAdds
The previously reported connection-settings issue is fixed. No new actionable issues were found in the changes since the previous review.
|
…p 401 OAuth errors, mark hand-written code for oagen Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
@greptileai review |
Description
Adds
workos.connect.exchangeToken(options)for the Connect token exchange grant (workos/workos#77337): a first-party Connect Application exchanges an access token audienced to one Resource Indicator for one audienced to another.Unlike the rest of the SDK this does not call api.workos.com with the API key: the grant lives at
${issuer}/oauth2/tokenand is authenticated with the Connect Application's client ID + secret, so the method builds aFetchHttpClientfor the issuer (noAuthorizationheader), POSTs the form-encoded RFC 8693 parameters (grant_type=urn:ietf:params:oauth:grant-type:token-exchange,subject_token,subject_token_type/requested_token_type=…:access_token,resource, optionalscope), and reusesWorkOS.handleHttpError/readResponseJSONso OAuth errors (invalid_grant,invalid_target,invalid_scope,unauthorized_client,unsupported_grant_type) surface asOauthExceptionlike everywhere else; a 401 with an RFC 6749 body (invalid_client) is also mapped toOauthExceptionrather than the API-keyUnauthorizedException. The issuer client is built from the SDK'sfetchFn/timeout/maxRetries/configoptions so proxies and deadlines behave like every other call. The hand-written code is fenced with@oagen-ignoreso regeneration keeps it. Those two helpers go fromprivateto/** @internal */for that.Response is deserialized to
{ accessToken, issuedTokenType, tokenType, expiresIn, scope? }(scopeomitted when absent).Tests:
connect.spec.tscovers URL/body/no-Authorization-header, scope omission, 400 and 401OauthExceptionmapping, and customfetchFnpropagation.npm run lint,npm run format,tsc --noEmitclean.Documentation
Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.
Reference page for the grant: workos/workos#77556 (Node snippet to follow once this method's name is settled).
Link to Devin session: https://app.devin.ai/sessions/82cf47fee15f412ab6c3bb2a3e12b2dd
Open in Devin Desktop: https://app.devin.ai/desktop/session/82cf47fee15f412ab6c3bb2a3e12b2dd?variant=devin
Requested by: @m0tzy