Fix misleading AADSTS9002326 sign-in guidance and surface silent SPA-repair failures - #58
Open
gnjoseph wants to merge 4 commits into
Open
Fix misleading AADSTS9002326 sign-in guidance and surface silent SPA-repair failures#58gnjoseph wants to merge 4 commits into
gnjoseph wants to merge 4 commits into
Conversation
…repair failures
The scaffolded React SPA could fail sign-in with AADSTS9002326 even when the SPA
redirect URI was already registered, and the app's own error copy asserted this
was definitively a server-side missing-redirect-URI problem - misdirecting users
away from the most common cause: the running build signs in as a different
app/tenant than the one edited in the portal.
- create-app: capture the reused-app addSpaRedirectUris({bestEffort}) result and
emit a non-blocking advisory (new spa-redirect-advisory.ts) naming the client
id, object id, and manual az rest PATCH/GET when the local SPA redirect URI
cannot be confirmed. Previously the failure was silently swallowed.
- hydrate-config: append an offline "verify this .env targets the right app"
advisory to tool output (never to .env); warn when tenant id is blank.
- auth-error-guidance (+ App.tsx twin + run-local note): reframe as "almost
always a config mismatch", lead remediation with confirming VITE_CLIENT_ID /
VITE_TENANT_ID match the app in the portal Overview and rebuilding after .env
changes; keep SPA-redirect add steps and az rest GET verification.
Fixes #57
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… skill Companion to the AADSTS9002326 fixes: make it easy for users to self-diagnose sign-in failures and, when needed, file triage-ready reports. - .github/ISSUE_TEMPLATE: guided Bug report and Sign-in / AADSTS error forms (the latter collects .env vs. portal identity, spa.redirectUris via az rest, and the exact AADSTS code), plus config.yml with support/security/troubleshoot contact links. - .github/skills/report-spe-mcp-issue: an agent skill that walks a user through gathering those diagnostics, redacting secrets, and drafting a gh issue create. - docs/TROUBLESHOOTING.md: new "React SPA sign-in fails with AADSTS9002326" section documenting the config-mismatch root cause and az rest verify/repair. - README, SUPPORT, CHANGELOG: link the templates + skill and record the change. Relates to #57 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… headline The issue-reporting skill and templates led with sign-in / AADSTS as the primary focus. Reframe the whole apparatus as general SPE MCP issue reporting, with sign-in/AADSTS demoted to one specialized category (its dedicated form and diagnostics are kept). - SKILL.md: generic-first. "Try to resolve first" and "Classify" now span MCP tool calls, scaffolding/build, deploy, install/packaging, and docs, with sign-in/AADSTS as a special case. Diagnostics list the general fields first and the sign-in extras second. Examples default to the Bug report form. - config.yml: replace the "Sign-in / AADSTS troubleshooting" contact link with a general "Troubleshooting guide" link (sign-in is one of the topics it covers). - bug_report.yml: broaden the description and add an "Area" dropdown (tool call / scaffolding / build / deploy / install / docs / other) so it reads as the catch-all. - SUPPORT.md / CHANGELOG.md: describe the general Bug report form first and the sign-in form second. Relates to #57. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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
Fixes #57.
The scaffolded React SPA could fail sign-in with
AADSTS9002326even when the SPAredirect URI was already registered, and the app's own error copy asserted this was
definitively a server-side missing-redirect-URI problem ("NOT a bug in this app and NOT a
stale or not-reloaded dev server"). That misdirects users away from the most common real
cause: the running build signs in as a different app/tenant than the one edited in the
portal (Vite inlines
VITE_CLIENT_ID/VITE_TENANT_IDat build time; a duplicate displayname can also select the wrong app).
Changes
Fixes
src/auth-error-guidance.ts+ itsbyte-for-byte twin
samples/react-spa-functions/src/App.tsx+ theproject_run_localnote): reframe as "almost always a configuration mismatch" and lead remediation with
confirming the running build's
VITE_CLIENT_ID/VITE_TENANT_IDmatch the app in theportal Overview blade (and rebuilding after
.envchanges), then keep the SPA-redirectadd steps plus an
az rest GETverification. AADSTS codes / origin /az rest PATCHtokens are preserved.
src/tools/create-app.tssrc/spa-redirect-advisory.ts): capture theaddSpaRedirectUris(..., { bestEffort })result and, when the local SPA redirect URI can't be confirmed on a reused app, append a
non-blocking advisory naming the exact client id / object id and the manual
az restPATCH/GET. The tool still succeeds.
project_hydrate_config(
src/tools/hydrate-config.ts): append a persistent "verify this.envtargets the rightapp" note to the tool output (never to
.env), and warn when the tenant id is blank(invalid MSAL authority).
Issue reporting (companion)
.github/ISSUE_TEMPLATE/: a general Bug report form and a dedicated Sign-in / AADSTSerror form (collects
.envvs. portal identity,spa.redirectUrisviaaz rest, and theexact AADSTS code), plus
config.ymlcontact links..github/skills/report-spe-mcp-issue/: an agent skill that walks a user through gatheringthose diagnostics, redacting secrets, and drafting a
gh issue create.docs/TROUBLESHOOTING.md: new "React SPA sign-in fails withAADSTS9002326" section (thecanonical fix the template + skill link to). README / SUPPORT / CHANGELOG updated.
Testing
npm run ci(typecheck + build +vitest run): all 758 tests pass (7 skipped).npm run lintandnpm run typecheck: clean.interpretAuthErrorverified byte-for-byte identical betweenauth-error-guidance.tsand
App.tsx(drift-guard test enforces this).Notes
The original report's exact sub-cause can't be determined from the issue alone (needs the
reporter's
.envVITE_*values vs. the portal Overview client/tenant id and that app'sspa.redirectUris). These changes make that mismatch self-evident in tool output and inthe app's own error guidance instead of misdirecting the user.