[ENG-4086] feat(custom-auth): multi-step custom auth flow (admin consent)#1628
Open
RajatPawar wants to merge 4 commits into
Open
[ENG-4086] feat(custom-auth): multi-step custom auth flow (admin consent)#1628RajatPawar wants to merge 4 commits into
RajatPawar wants to merge 4 commits into
Conversation
…NG-4086] Add the consumer-facing driver for providers whose ProviderInfo has customOpts.multiStep. It POSTs the form to /custom-auth/connect and, while the server returns a redirect, opens it in a popup and resumes with the params the callback forwards, until the server returns a connection. Add-only, no changes to the existing single-step custom auth: - MultiStep/MultiStepCustomAuthFlow.tsx: the popup + postMessage resume loop. - MultiStep/MultiStepCustomAuthContent.tsx: a fieldType-aware form (text/password/select) rendered from customOpts.inputs. - form/Select: a native select form primitive (reuses the shared input styles). - useCustomAuthConnectMutation: thin react-query wrapper over connectionApi. - ProtectedConnectionLayout: the only existing file touched — an additive sub-branch that routes custom+multiStep here; every current provider (none set multiStep) still hits the unchanged CustomAuthFlow. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
RajatPawar
requested review from
a team,
dionlow,
eberle1080 and
laurenzlong
and removed request for
a team,
dionlow and
eberle1080
July 15, 2026 23:56
laurenzlong
approved these changes
Jul 22, 2026
| /** | ||
| * Drives a multi-step custom auth flow: submit the form to /custom-auth/connect, | ||
| * and while the server returns a redirect, open it in a popup and resume with the | ||
| * params the callback forwards, until the server returns a connection. |
Contributor
There was a problem hiding this comment.
Suggested change
| * params the callback forwards, until the server returns a connection. | |
| * params the callback forwards, until the server returns a successfully created Connection. |
| const onMessage = (ev: MessageEvent<CustomAuthCallbackMessage>) => { | ||
| // Accept only messages from the API origin (where the callback is served). | ||
| if (ev.origin !== AMP_SERVER) return; | ||
| if (ev.data?.source !== "ampersand-custom-auth") return; |
Contributor
There was a problem hiding this comment.
put "ampersand-custom-auth" into a constant, and also use it in line 25 above
…nt + doc wording - Hoist "ampersand-custom-auth" message source into CALLBACK_MESSAGE_SOURCE, reused by the message type (via typeof) and the listener guard - Clarify flow JSDoc wording Co-Authored-By: Claude Opus 4.8 <[email protected]>
…elect - Render FieldTypeSelect via the shared ui-base/ComboBox (as field mapping does) instead of a bespoke form/Select; delete form/Select - Disable Next until every custom input is filled; a select must resolve to a declared option (rejects the empty placeholder) Co-Authored-By: Claude Opus 4.8 <[email protected]>
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.
What
Adds the consumer-facing multi-step custom auth flow to the UI library — for providers whose
ProviderInfohascustomOpts.multiStep(e.g. Microsoft Admin Consent).MultiStepCustomAuthFlow— POSTs the form to/custom-auth/connect; while the server returns aredirect, opens it in a popup and resumes with the params the callback forwards (viapostMessage, origin-checked) until the server returns aconnection.MultiStepCustomAuthContent— afieldType-aware form (text / password / select) rendered fromcustomOpts.inputs.form/Select— a native select primitive (reuses the shared input styles).useCustomAuthConnectMutation— thin react-query wrapper overconnectionApi.customAuthConnect.ProtectedConnectionLayout— the only existing file touched: an additive sub-branch routingcustom+multiStephere; every current provider still hits the unchanged single-stepCustomAuthFlow.Testing
Depends on
customAuthConnect,CustomAuthConnectRequest/Response,CustomAuthInput.fieldType/options,customOpts.multiStep) from the auto openapi-sync [auto] Update openapi dependency #1627. Once [auto] Update openapi dependency #1627 merges, I'll rebase to drop that commit so the diff is just the feature./custom-auth/connect(server #6747) + connectors registry (connectors #3184) at runtime.🤖 Generated with Claude Code