So I have made a OneDrive uploader, which uses Azure, and currently it doesn't work with education or workplace accounts. It only works with normal Microsoft accounts. How can I make my app work with other kinds of microsoft accounts?
I have the following code if that helps: (this is what i have tried to do.)
var accounts = await app.GetAccountsAsync(); firstAccount = accounts.FirstOrDefault();
authResult = await app.AcquireTokenInteractive(scopes)
.WithAccount(firstAccount)
.WithParentActivityOrWindow(new WindowInteropHelper(this).Handle)
.WithPrompt(Microsoft.Identity.Client.Prompt.SelectAccount)
.ExecuteAsync();
IPublicClientApplication publicClientApp = PublicClientApplicationBuilder.Create(client_id)
.WithRedirectUri("https://login.microsoftonline.com/common/oauth2/nativeclient")
.WithAuthority(AzureCloudInstance.AzurePublic, tenant)
.Build();
these are the main areas of code which I think have to be changed in order for it to work. (if it is even possible.)
It is supposed to be able to allow you to sign into an account and access your onedrive, but if you try to sign in with an education account, for example, it comes up with this:
The error usually occurs if your application Supported account type is "Personal Microsoft accounts only" but you tried to sign in with education or workplace accounts.
I tried to reproduce the same in my environment and got the below results:
I registered one Azure AD application with Supported account type
as "Personal Microsoft accounts only" as below:
You can check Supported account type
of existing application from it's Authentication tab like this:
You can also check signInAudience
value in app's Manifest file like below:
When I tried to sign in with workplace account instead of personal Microsoft account, I got same error as you like below:
To resolve the error, you need to change Supported account type
of your application by modifying it's Manifest file like this:
"signInAudience": "AzureADandPersonalMicrosoftAccount",
When I checked Authentication tab now, Supported account type
changed successfully like below:
If the error still persists, try registering a new Azure AD application by selecting Supported account type
as below and repeat the whole process again: