Skip to content

feat(connect): Add getAuthorizationUrl and getAuthorizationUrlWithPKCE - #1770

Open
m0tzy wants to merge 1 commit into
mainfrom
devin/1795186736-connect-authorization-url
Open

m0tzy wants to merge 1 commit into
mainfrom
devin/1795186736-connect-authorization-url

Conversation

@m0tzy

@m0tzy m0tzy commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds two URL builders for Connect Applications, so OAuth/MCP clients don't have to build the authorize URL by hand:

  • workos.connect.getAuthorizationUrl(options) returns ${issuer}/oauth2/authorize?...
  • workos.connect.getAuthorizationUrlWithPKCE(options) generates the code verifier, S256 challenge and state, and returns { url, state, codeVerifier }

Supported options: issuer, clientId, redirectUri, scope, state, nonce, organizationId, loginHint, prompt, resource, codeChallenge, codeChallengeMethod. response_type=code is always set.

organizationId maps to organization_id, which is now strict on /oauth2/authorize (FEAT-3008 / FEAT-2968). The org picker is skipped, and a user who isn't an active member of the org is redirected to redirect_uri with error=access_denied.

These are hand-written inside @oagen-ignore blocks, like exchangeToken. /oauth2/authorize is served on the AuthKit domain (the issuer), not api.workos.com, and isn't in the public OpenAPI spec. So the URL is built from issuer instead of baseURL, with any trailing slash removed.

userManagement.getAuthorizationUrl (/user_management/authorize) is unchanged.

const { url, state, codeVerifier } =
  await workos.connect.getAuthorizationUrlWithPKCE({
    issuer: 'https://auth.example.com',
    clientId: 'client_123',
    redirectUri: 'myapp://callback',
    organizationId: 'org_01EHZNVPK3SFK441A1RGBFSHRT',
    resource: 'https://mcp.example.com',
  });

Documentation

Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.

[ ] Yes

The Connect authorize reference already documents organization_id. A Node snippet could be added there later.

Link to Devin session: https://workos.devinenterprise.com/sessions/7eb7f4b6911143119e16e337f4461843
Open in Devin Desktop: https://workos.devinenterprise.com/desktop/session/7eb7f4b6911143119e16e337f4461843?variant=devin
Requested by: @m0tzy


🟢 Devin Review found nothing to fix · View findings

Devin Review

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@m0tzy
m0tzy requested review from a team as code owners November 20, 2026 15:00
@m0tzy
m0tzy requested a review from atainter November 20, 2026 15:00
@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

Original prompt from Madison

SYSTEM:
<latest_message>
Madison Packer (U0ACAL99VSL) [ts=1795159779.222919]: how many customers asked for the organization_id binding?
</latest_message>

=== BEGIN THREAD HISTORY ===
Madison Packer (U0ACAL99VSL) [ts=1795159779.222919]: how many customers asked for the organization_id binding?
=== END THREAD HISTORY ===
Channel ID: D0B0HJKKE3V
Thread URL: https://work-os.slack.com/archives/D0B0HJKKE3V/p1795159779222919?thread_ts=1795159779.222919&amp;cid=D0B0HJKKE3V

The <latest_message> is the message that you should use to guide your goals + task for this session, and you should use the rest of the slack thread as context.
A [ts=...] marker on a Slack message is that message's timestamp. To act on a specific message with the slack tool (e.g. adding an emoji reaction via the reaction command), pass that value as timestamp along with the Channel ID — no extra lookup call is needed.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@greptile-apps

greptile-apps Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

Adds getAuthorizationUrl and getAuthorizationUrlWithPKCE for Connect applications.

  • Connect callers can build issuer authorization URLs with or without PKCE.

No actionable issues were found. Tests were inspected, not run.

Reviews (1) · Last reviewed commit: "feat(connect): Add getAuthorizationUrl a..." · Reviewed by Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant