Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to login with Personal accounts MSAL #7570

Open
2 tasks
ayush4computing opened this issue Feb 14, 2025 · 2 comments
Open
2 tasks

Not able to login with Personal accounts MSAL #7570

ayush4computing opened this issue Feb 14, 2025 · 2 comments
Labels
bug-unconfirmed A reported bug that needs to be investigated and confirmed confidential-client Issues regarding ConfidentialClientApplications msal-node Related to msal-node package Needs: Attention 👋 Awaiting response from the MSAL.js team question Customer is asking for a clarification, use case or information.

Comments

@ayush4computing
Copy link

Core Library

MSAL Node (@azure/msal-node)

Core Library Version

1.17.3

Wrapper Library

Not Applicable

Wrapper Library Version

NA

Public or Confidential Client?

Confidential

Description

We are currently not able to login with personal Microsoft account, earlier it was working fine and we haven't made any code changes. Earlier it was working fine but now we are seeing this issue.
Our old personal accounts are still working fine but the newly created accounts are seeing the problem.

Error Message

This is the error that we are getting

req.body [Object: null prototype] {
error: 'server_error',
state: 'eyJzdWNjZXNzUmVkaXJlY3QiOiIvIn0='
}

ClientAuthError: request_cannot_be_made: Token request cannot be made without authorization code or refresh token.

MSAL Logs

No response

Network Trace (Preferrably Fiddler)

  • Sent
  • Pending

MSAL Configuration

const endpoint = 'https://login.microsoftonline.com/common/discovery/instance';

This is the endpoint that we are using

Relevant Code Snippets

handleRedirect(options = {}) {
        return async (req, res, next) => {
            if (!req.body || !req.body.state) {
                return next(new Error('Error: response not found'));
            }

 const authCodeRequest = {
                        ...req.session.authCodeRequest,
                        code: req.body.code,
                        codeVerifier: req.session.pkceCodes.verifier,
                    };

                    const msalInstance = this.getMsalInstance(this.msalConfig);

                    if (req.session.tokenCache) {
                        msalInstance.getTokenCache().deserialize(req.session.tokenCache);
                    }

                    const tokenResponse = await msalInstance.acquireTokenByCode(authCodeRequest, req.body);

                    req.session.tokenCache = msalInstance.getTokenCache().serialize();

                    req.session.account = tokenResponse.account;
                    req.session.isAuthenticated = true;

                    const state = JSON.parse(this.cryptoProvider.base64Decode(req.body.state));
                    
                    this.acquireToken({
                        scopes: ['Test.ReadWrite'],
                        redirectUri: REDIRECT_URI,
                        successRedirect: POST_LOGOUT_REDIRECT_URI
                    })(req, res, next);
                } catch (error) {
                    console.log(error);
                    res.redirect(POST_LOGOUT_REDIRECT_URI)
                }

Reproduction Steps

  1. Login in with personal microsoft account
  2. It redirects back to the login page

Expected Behavior

It should logged in the user with personal account

Identity Provider

Entra ID (formerly Azure AD) / MSA

Browsers Affected (Select all that apply)

Chrome

Regression

No response

@ayush4computing ayush4computing added bug-unconfirmed A reported bug that needs to be investigated and confirmed question Customer is asking for a clarification, use case or information. labels Feb 14, 2025
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: Attention 👋 Awaiting response from the MSAL.js team label Feb 14, 2025
@github-actions github-actions bot added confidential-client Issues regarding ConfidentialClientApplications msal-node Related to msal-node package labels Feb 14, 2025
@ayush4computing
Copy link
Author

Team, this is on high priority for us.

@ayush4computing
Copy link
Author

@ocindev @tnorling
Do you guys have thoughts on this, please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-unconfirmed A reported bug that needs to be investigated and confirmed confidential-client Issues regarding ConfidentialClientApplications msal-node Related to msal-node package Needs: Attention 👋 Awaiting response from the MSAL.js team question Customer is asking for a clarification, use case or information.
Projects
None yet
Development

No branches or pull requests

1 participant