microsoftgraph / aspnetcore-connect-sample

[ARCHIVED] This ASP.NET Core MVC sample shows how to connect to Microsoft Graph using delegated permissions and the Azure AD v2.0 (MSAL) endpoint.
MIT License
123 stars 96 forks source link

Support for signInAudience AzureADMyOrg or AzureADMultipleOrgs #28

Closed joelhaslerfhnw closed 5 years ago

joelhaslerfhnw commented 5 years ago

I have a question! Until know it works for any account (AzureADMultipleOrgs --> common Endpoint). Do you know what need to be changed in the code so that it works? On the registration side I already changed it.

Many thanks for your help Regards, Joël

mark-szabo commented 5 years ago

Hi Joel, I'm really sorry, but I don't quite understand your question. MSAL (AzureAD Authentication Library v2) supports multi-tenant by default. If you want users from one tenant only to be able to log into your app, you can filter users by tenantid after the authentication is successful and you get a token. Therefore you should use the common endpoint when using MSAL.

Let me know whether your question was answered! 😊

ccit-spence commented 5 years ago

FYI for a single tenant, getting this error:

Usage of the /common endpoint is not supported for such applications created after '10/15/2018'. Use a tenant-specific endpoint or configure the application to be multi-tenant.

Not sure yet how to fix it based on this sample.

mprattinger commented 5 years ago

I get the same error as ccit-spence. Don't know how to fix this

Thanks for any advise regards Michael

mark-szabo commented 5 years ago

If you are creating the AD app in the Azure portal, click the switch to make the app multi-tenant.

rdantas9 commented 1 year ago

Is there any example to configure my Apps for only one tenant can be authenticated?

mark-szabo commented 1 year ago

Hey @rdantas9 , please have a look over here: https://learn.microsoft.com/en-us/azure/active-directory/develop/single-and-multi-tenant-apps#who-can-sign-in-to-your-app