Skip to content

having both SPA and mobile and desktop redirect URIs leads to an error #212

@ekdnam

Description

@ekdnam

Describe the bug
A clear and concise description of what the bug is.

I followed both the Azure Active Directory app registration procedures as stated in ./README.md and ./tools/importdocument/README.md.

Specifically:
From ./README.md

Supported account types: "Accounts in any organizational directory (Any Azure AD directory - Multitenant) and personal Microsoft accounts (e.g. Skype, Xbox)"
Redirect URI (optional): Single-page application (SPA) and use http://localhost:3000/.

and ./tools/importdocument/README.md

A registered App in Azure Portal (https://learn.microsoft.com/azure/active-directory/develop/quickstart-register-app)
Select Mobile and desktop applications as platform type, and the Redirect URI will be http://localhost
Select Accounts in any organizational directory (Any Azure AD directory - Multitenant) and personal Microsoft accounts (e.g. Skype, Xbox) as the supported account type for this sample.
Note the Application (client) ID from your app registration.

If there are both, it leads to the error

invalid_request: 90023 - [2023-08-18 13:08:17Z]: AADSTS90023: Cross-origin token redemption is permitted only for the 'Single-Page Application' client-type or 'Native' client-type with origin registered in AllowedOriginForNativeAppCorsRequestInOAuthToken allow list.
Trace ID: ---
Correlation ID: ---
Timestamp: 2023-08-18 13:08:17Z - Correlation ID: --- - Trace ID: ---
AuthError@http://localhost:3000/static/js/bundle.js:34540:20
ServerError@http://localhost:3000/static/js/bundle.js:35580:24
./node_modules/@azure/msal-common/dist/response/ResponseHandler.js/ResponseHandler.prototype.validateTokenResponse@http://localhost:3000/static/js/bundle.js:36903:13
./node_modules/@azure/msal-common/dist/client/AuthorizationCodeClient.js/AuthorizationCodeClient.prototype.acquireToken/AuthorizationCodeClient</<@http://localhost:3000/static/js/bundle.js:33038:29
step@http://localhost:3000/static/js/bundle.js:28896:17
./node_modules/@azure/msal-common/dist/_virtual/_tslib.js/__generator/verb/<@http://localhost:3000/static/js/bundle.js:28845:14
fulfilled@http://localhost:3000/static/js/bundle.js:28804:24

However if I remove the Mobile and desktop applications redirect URI and just keep SPA, the app works fine.

How to resolve?

To Reproduce
Steps to reproduce the behavior:

  1. Described above

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Platform

  • OS: MacOS
  • IDE: VS Code
  • Language: C#
  • Source: main branch of chat-copilot

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

deploymentIssues related to deploying Chat-Copilotexternal dependency issueIssues related to external dependencies (e.g. Azure)questionFurther information is requested

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions