microsoftgraph / msgraph-training-dotnet

Microsoft Graph Training Module - Build .NET apps with Microsoft Graph
MIT License
118 stars 86 forks source link

Personal Account and User-Auth Fails #277

Open ericjohannsen opened 3 months ago

ericjohannsen commented 3 months ago

Where did you get the code?

Describe the bug

Unable to register an application using a personal account using either method described in README.md under user-auth

To Reproduce Steps to reproduce the behavior:

The readme in the user-auth folder states to register an application using Azure Active Directory admin center or with the provided Powershell script.

Using AAD with a personal account subscribed to O365 yields this error:

image

The Sign in again button leads to:

image

When I instead attempt to register the application using the provided Powershell script, that script informs me to:

To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code XXXXXXXX to authenticate.

On that page, I am prompted:

image

I enter the personal email address with which I am subscribed to O365 and get the error message:

image

If I instead sign in with an outlook.com email address, otherwise following the same procedure, I get:

image

Expected behavior The application registration process should succeed

Screenshots See reproduction steps

Desktop (please complete the following information):

Dependency versions

Version Name Repository Description


2.21.0 Microsoft.Graph PSGallery Microsoft Graph PowerShell module

Additional context

jasonjoh commented 3 months ago

Focusing on your first error - that indicates that the registered application was registered with the Accounts in this organizational directory only option, and you're attempting to sign into that application with an account (from live.com) that does not exist in the organization where you registered the app.

If you're looking to support personal accounts, you should create an app registration with the Accounts in any organizational directory ... and personal Microsoft accounts option.

ericjohannsen commented 3 months ago

I appreciate the feedback. This is a new topic for me so I followed the instructions in README.md verbatim. I don't know how to follow your advice, but I'll spend some time looking into it this evening and will create a PR for README.md if I find something useful.