Issues with OpenIdConnect and MS Identity Web

Fabian Homann 46 Reputation points
2024-01-08T10:44:43.6533333+00:00

I use OpenId Authentication combined with MS Identity Web within a .NET6 Razorpage Project.

I can log in with an account with Global Admin and "TENANT.onmicrosoft.com" and am redirected to /Index. As soon as I want to log in with a "mail" account without role, I get the following error message after the "Do you want to log in permanently?":

Microsoft.IdentityModel.Protocols.OpenIdConnect.OpenIdConnectProtocolException: Message contains error: 'invalid_request', error_description: 'AADSTS500208: The domain is not a valid login domain for the account type. Trace ID: d1fa4b6a-f9d2-4b89-89f6-1b25e5ac0600 Correlation ID: ef98b16d-b46e-4062-bacc-9bd6b136ab24 Timestamp: 2024-01-08 10:29:19Z', error_uri: 'error_uri is null'.

This error occurs on the /signin-oidc page.

I have configured the application for this as follows:

Web redirect URI's:

https://localhost:xxxx/signin-oidc

https://localhost:xxxx/Index

URL for front channel logout:

https://localhost:xxxx/signout-oidc

✔️ Access tokens (used for implicit flows)

✔️ ID token (used for implicit and hybrid flows)

✔️ Accounts in any organizational directory (any Microsoft Entra ID client - multi-tenant capable)

In addition, a user flow with email one-time passcode and Google, Facebook runs behind it.

If a user logs in with Global Admin with the following criteria:

Identities ExternalAzureAD

User type Member

it works.

As soon as Global Admin is revoked, the error shown above appears again. So it seems to be a rights problem?

Greetings.

Developer technologies | ASP.NET | ASP.NET Core
Microsoft Security | Microsoft Entra | Microsoft Entra ID
{count} votes

1 answer

Sort by: Most helpful
  1. Shweta Mathur 30,446 Reputation points Microsoft Employee Moderator
    2024-01-09T07:22:53.1333333+00:00

    Hi @Fabian Homann ,

    Thanks for reaching out.

    The error message you are receiving indicates that the domain you are trying to log in with is not a valid login domain for the account type.

    This error is by design in External ID for customers when customers are trying to access Microsoft endpoint which they don't have permission to access and require admin rights to access that endpoint. So, to access the application by users created in customer tenant, they have to access the <tenantname.ciamlogin.com> endpoint. Hope this will help.

    Thanks,

    Shweta


    Please remember to "Accept Answer" if answer helped you.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.