Skip to content

Fix SSO+OBO flow for declarative agents: correct identifierUris, add missing redirect URIs, surface OBO diagnostics#15786

Draft
Copilot wants to merge 2 commits intodevfrom
copilot/fix-sso-obo-flow-issues
Draft

Fix SSO+OBO flow for declarative agents: correct identifierUris, add missing redirect URIs, surface OBO diagnostics#15786
Copilot wants to merge 2 commits intodevfrom
copilot/fix-sso-obo-flow-issues

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 23, 2026

When identityProvider: MicrosoftEntra is used in oauth/register, the OBO token exchange silently fails due to incorrect AAD app configuration generated by the toolkit templates. Error 50011 (redirect URI mismatch) also fires during SSO because only one of two required redirect URIs was configured.

Root causes fixed

  • identifierUris conflict — Templates had both api://${{OPENAPI_SERVER_DOMAIN}}/${{AAD_APP_CLIENT_ID}} and ${{AADAUTHCODE_APPLICATION_ID_URI}} as identifier URIs for the MicrosoftEntra case. Azure AD can issue SSO tokens with the wrong URI as audience, silently breaking the downstream OBO exchange. Fixed to only emit ${{AADAUTHCODE_APPLICATION_ID_URI}} (the value set by oauth/register).

  • Missing redirect URI (error 50011) — Only oAuthConsentRedirect was registered; the platform also sends oAuthRedirect during SSO. Both are now configured for MicrosoftEntra.

  • Scope URI mismatch — OpenAPI spec scopes referenced api://${{OPENAPI_SERVER_DOMAIN}}/${{AAD_APP_CLIENT_ID}}/repairs_read, inconsistent with the now-single identifier URI. Updated to ${{AADAUTHCODE_APPLICATION_ID_URI}}/repairs_read.

  • Silent failuresoauth/register only showed a terse UI popup with no log output. Now emits a structured warning to the log provider and a second info-level OBO diagnostic log.

Changes

  • aad.manifest.json.tpl (ts, js, csharp variants)

    • identifierUris: removed api://domain/clientId, kept only ${{AADAUTHCODE_APPLICATION_ID_URI}}
    • web.redirectUris: added oAuthRedirect alongside oAuthConsentRedirect for MicrosoftEntra
  • repair.yml.tpl (ts, js, csharp variants) — MicrosoftEntra scope changed from api://${{OPENAPI_SERVER_DOMAIN}}/${{AAD_APP_CLIENT_ID}}/repairs_read to ${{AADAUTHCODE_APPLICATION_ID_URI}}/repairs_read

  • constants.ts — Added microsoftEntraOboInfo log key and additionalRedirectUri constant (oAuthRedirect URL)

  • create.ts — Warning message now logged to logProvider in addition to the UI popup; new info log emitted with OBO checklist (single identifierUri, access_as_user scope, pre-authorized clients, idtyp optional claim, sign-in log error codes)

  • package.nls.jsonmicrosoftEntraWarning updated to name both required redirect URIs and explicitly warn against adding extra identifier URIs; new microsoftEntraOboInfo key added

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/950341/chrome-linux.zip
    • Triggering command: /usr/local/bin/node node install.js (http block)

If you need me to access, download, or install something from one of these locations, you can either:

… identifierUris, add redirect URIs

Agent-Logs-Url: https://github.com/OfficeDev/microsoft-365-agents-toolkit/sessions/b88f930d-aad3-4922-9191-d1d66283e283

Co-authored-by: HuihuiWu-Microsoft <73154171+HuihuiWu-Microsoft@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix SSO and OBO flow for Declarative Agents calling Microsoft Graph Fix SSO+OBO flow for declarative agents: correct identifierUris, add missing redirect URIs, surface OBO diagnostics Apr 23, 2026
@QueenFi703
Copy link
Copy Markdown

QueenFi703 commented Apr 23, 2026 via email

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SSO + OBO Flow for Declarative Agents Calling Microsoft Graph

3 participants