Skip to content

msalInstance.acquireTokenByCode not working #7425

Open
@denghejun

Description

@denghejun

Core Library

MSAL.js (@azure/msal-browser)

Core Library Version

3.27.0

Wrapper Library

MSAL React (@azure/msal-react)

Wrapper Library Version

2.2.0

Public or Confidential Client?

Public

Description

const tokenResponse = await msalInstance.acquireTokenByCode({
code: payload.code,
scopes: [ "user.read" ],
redirectUri: "https://xxx/oauth/aad/callback",
redirect_url: "https://xxx/oauth/aad/callback",
redirectUrl: "https://xxx/oauth/aad/callback"
});

Error Message

erverError: invalid_grant: Error(s): 700009 - Timestamp: 2024-11-18 08:19:26Z - Description: AADSTS700009: Reply address must be provided when presenting an authorization code requested with an explicit reply address. Trace ID: bb8fc0ba-128b-47f5-8990-4f9beaff2c00 Correlation ID: 01933e5a-ec11-71cf-97ff-814e82630d82 Timestamp: 2024-11-18 08:19:26Z - Correlation ID: 01933e5a-ec11-71cf-97ff-814e82630d82 - Trace ID: bb8fc0ba-128b-47f5-8990-4f9beaff2c00

MSAL Logs

No response

Network Trace (Preferrably Fiddler)

  • Sent
  • Pending

MSAL Configuration

const msalInstance = await msal.createStandardPublicClientApplication({
    auth: {
        clientId: "FAKE_1", // use fake one here, please ignore
        authority: "FAKE_2",
        redirectUri: "https://xxx/oauth/aad/callback"
    },
});

Relevant Code Snippets

const tokenResponse = await msalInstance.acquireTokenByCode({
            code: payload.code,
            scopes: [ "user.read" ],
            redirectUri: "https://xxx/oauth/aad/callback",
            redirect_url: "https://xxx/oauth/aad/callback",
            redirectUrl: "https://xxx/oauth/aad/callback"
        });

Reproduction Steps

as the code desc

Expected Behavior

get token success

Identity Provider

Entra ID (formerly Azure AD) / MSA

Browsers Affected (Select all that apply)

Chrome, Firefox, Edge, Safari, Other

Regression

NA

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: Attention 👋Awaiting response from the MSAL.js teambug-unconfirmedA reported bug that needs to be investigated and confirmedmsal-browserRelated to msal-browser packagemsal-reactRelated to @azure/msal-reactpublic-clientIssues regarding PublicClientApplicationsquestionCustomer is asking for a clarification, use case or information.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions