You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've setup a new Entra App Registration as described in the docs.
I've then run m365 setup, and configured it to use interactive login.
When I run m365 login, my browser opens a tab at https://login.microsoftonline.com, but I get an error stating that the redirect URI specified in the request does not match the redirect URI configured for the application.
I have tried selecting a bunch of different options in m365 setup, but I always end up in the same place, with the non-matching redirect URI error above.
Expected results
I expect the login to succeed.
Actual results
Error:
AADSTS50011: The redirect URI 'http://localhost:58946' specified in the request does not match the redirect URIs configured for the application 'abc-123-example'. Make sure the redirect URI sent in the request matches one added to your application in the Azure portal. Navigate to https://aka.ms/redirectUriMismatchError to learn more about how to fix this.
Diagnostics
m365 login --authType browser --debug
Executing command login with options {"options":{"output":"json","debug":true,"verbose":false,"authType":"browser","cloud":"Public"}}
Executing command as '[email protected]', appId: abc-123-example, tenantId: xyz-456-example
Logging out from Microsoft 365...
Signing in to Microsoft 365...
No token found for resource https://graph.microsoft.com.
[Wed, 02 Oct 2024 01:49:15 GMT] : [] : @azure/[email protected] : Info - getTokenCache called
[Wed, 02 Oct 2024 01:49:15 GMT] : [] : @azure/[email protected] : Info - CacheManager:getIdToken - Returning ID token
Retrieving new access token using interactive browser session...
Redirect URL:
https://login.microsoftonline.com/xyz-456-example/oauth2/authorize?response_type=code&client_id=abc-123-example&redirect_uri=http://localhost:59779&state=123456&resource=https://graph.microsoft.com&prompt=select_account
To sign in, use the web browser that just has been opened. Please sign-in there.
Priority
(Medium) I'm annoyed but I'll live
Skip to the end for a workaround.
Description
I've setup a new Entra App Registration as described in the docs.
I've then run
m365 setup
, and configured it to use interactive login.When I run
m365 login
, my browser opens a tab at https://login.microsoftonline.com, but I get an error stating that the redirect URI specified in the request does not match the redirect URI configured for the application.Steps to reproduce
I have confirmed that all the app registration configuration settings exactly match the description in the documentation:
https://pnp.github.io/cli-microsoft365/user-guide/using-own-identity/#configure-authentication-settings
The platform is Mobile and Desktop Applications.
The redirect URI is set to:
https://login.microsoftonline.com/common/oauth2/nativeclient
And Allow Public Client flows is set to 'Yes'.
I have tried selecting a bunch of different options in
m365 setup
, but I always end up in the same place, with the non-matching redirect URI error above.Expected results
I expect the login to succeed.
Actual results
Error:
Diagnostics
CLI for Microsoft 365 version
v9.0.0
nodejs version
bun.sh: 1.1.20
Operating system (environment)
Windows
Shell
PowerShell
cli doctor
Additional Info
Workaround
I can successfully login if I force it to use deviceCode login rather than browser login. This works:
This doesn't work (and is also the default when using
m365 login
):The text was updated successfully, but these errors were encountered: