I'm trying to create a multi-tenant application in AAD, where any organization can log in. I can get an authorization token using my credential of course it is our organization so it will work. what I'm trying to achieve is to acquire token using the username and password e.g:
u: test@company1.com p: test1
u: test@company2.com p: test2
u: test@company3.com p: test3 etc...
I get the following error: AADSTS65001: The user or administrator has not consented to use the application with ID [APP ID] Send an interactive authorization request for this user and resource.
I have already executed the grant admin consent from API permissions but still, I've got an error. what settings did I miss?
This is the way I initialize the IPublicClientAppliction:
var app = PublicClientApplicationBuilder
.Create(clientId)
.WithAuthority(AadAuthorityAudience.AzureAdMultipleOrgs)
.WithDefaultRedirectUri()
.Build();
var scopes = new string[]
{
"offline_access",
"email",
"https://outlook.office.com/IMAP.AccessAsUser.All"
};
var authToken = app.AcquireTokenByUsernamePassword(scopes,email,
password).ExecuteAsync();
Kind regards.


