Skip to content

Bug report: login fails with error 400 on 5.4.0 #3431

@crispinboylan-int

Description

@crispinboylan-int

Description

When logging in as normal with 5.4.0 using this:

I get:

Error: network_error: Network request failed. Please check network trace to determine root cause. | Fetch client threw: Error: HTTP status code 400 | Attempted to reach: https://login.microsoftonline.com/REDACTED/oauth2/v2.0/token

REDACTED has my normal tenant id in it.

Reverting to 5.3.0 works fine.

Steps to reproduce

m365 login --authType password --userName $(O365_USERNAME) --password '$(O365_PASSWORD)'

with CLIMICROSOFT365_AADAPPID and CLIMICROSOFT365_TENANT set

Expected results

Normal login.

Actual results

Error: network_error: Network request failed. Please check network trace to determine root cause. | Fetch client threw: Error: HTTP status code 400 | Attempted to reach: https://login.microsoftonline.com/REDACTED/oauth2/v2.0/token

Diagnostics

Logging out from Microsoft 365...
Signing in to Microsoft 365...
No token found for resource https://graph.microsoft.com
[Wed, 22 Jun 2022 15:50:20 GMT] : @azure/[email protected] : Info - getTokenCache called
Retrieving new access token using credentials...
[Wed, 22 Jun 2022 15:50:20 GMT] : @azure/[email protected] : Info - acquireTokenByUsernamePassword called
[Wed, 22 Jun 2022 15:50:20 GMT] : @azure/[email protected] : Verbose - initializeRequestScopes called
[Wed, 22 Jun 2022 15:50:20 GMT] : [b281d126-ebb6-4939-9615-8f1da061608a] : @azure/[email protected] : Verbose - buildOauthClientConfiguration called
[Wed, 22 Jun 2022 15:50:20 GMT] : [b281d126-ebb6-4939-9615-8f1da061608a] : @azure/[email protected] : Verbose - building oauth client configuration with the authority: https://login.microsoftonline.com/c55bd10c-6b74-4cf0-8a3f-48a5016d1997
[Wed, 22 Jun 2022 15:50:20 GMT] : [b281d126-ebb6-4939-9615-8f1da061608a] : @azure/[email protected] : Verbose - createAuthority called
[Wed, 22 Jun 2022 15:50:21 GMT] : [b281d126-ebb6-4939-9615-8f1da061608a] : @azure/[email protected] : Verbose - Username password client created
[Wed, 22 Jun 2022 15:50:21 GMT] : [b281d126-ebb6-4939-9615-8f1da061608a] : @azure/[email protected] : Info - in acquireToken call
Error:
ClientAuthError: network_error: Network request failed. Please check network trace to determine root cause. | Fetch client threw: Error: HTTP status code 400 | Attempted to reach: https://login.microsoftonline.com/REDACTED/oauth2/v2.0/token
at ClientAuthError.AuthError [as constructor] (/usr/lib/node_modules/@pnp/cli-microsoft365/node_modules/@azure/msal-common/dist/index.cjs.js:493:24)
at new ClientAuthError (/usr/lib/node_modules/@pnp/cli-microsoft365/node_modules/@azure/msal-common/dist/index.cjs.js:787:28)
at Function.ClientAuthError.createNetworkError (/usr/lib/node_modules/@pnp/cli-microsoft365/node_modules/@azure/msal-common/dist/index.cjs.js:830:16)
at NetworkManager. (/usr/lib/node_modules/@pnp/cli-microsoft365/node_modules/@azure/msal-common/dist/index.cjs.js:3374:51)
at step (/usr/lib/node_modules/@pnp/cli-microsoft365/node_modules/@azure/msal-common/dist/index.cjs.js:79:23)
at Object.throw (/usr/lib/node_modules/@pnp/cli-microsoft365/node_modules/@azure/msal-common/dist/index.cjs.js:60:53)
at rejected (/usr/lib/node_modules/@pnp/cli-microsoft365/node_modules/@azure/msal-common/dist/index.cjs.js:51:65)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
errorCode: 'network_error',
errorMessage: 'Network request failed. Please check network trace to determine root cause. | Fetch client threw: Error: HTTP status code 400 | Attempted to reach: https://login.microsoftonline.com/REDACTED/oauth2/v2.0/token',

CLI for Microsoft 365 version

5.4.0

nodejs version

17.3.1

Operating system (environment)

Linux

Shell

bash

cli doctor

No response

Additional Info

No response

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions