Base solution for your next web application
Open Closed

Graph integration - Cannot determine the cloud Instance. The provided authentication scheme was '' #11525


User avatar
0
Astech created

We are trying to get Graph integrated into our version 12 ABP ASP Net Zero (.Net Core MVC)

We have AD working fine after following method 2 of the following: https://community.abp.io/posts/how-to-use-the-azure-active-directory-authentication-for-mvc-razor-page-applications-4603b9cf?_ga=2.167438713.612361716.1679501585-1726878413.1679501585

Our Configure method in AuthConfigurer looks like so:

And our app settings:

However, when we call the graphclient, for example:

We get the following error: ---> System.InvalidOperationException: IDW10503: Cannot determine the cloud Instance. The provided authentication scheme was ''. Microsoft.Identity.Web inferred 'Identity.Application' as the authentication scheme. Available authentication schemes are 'Identity.Application,Identity.External,Identity.TwoFactorRememberMe,Identity.TwoFactorUserId,idsrv,idsrv.external,Cookies,OpenIdConnect,Bearer,IdentityBearerIdentityServerAuthenticationJwt,IdentityBearerIdentityServerAuthenticationIntrospection,IdentityBearer'. See https://aka.ms/id-web/authSchemes. at Microsoft.Identity.Web.TokenAcquisitionAspnetCoreHost.GetOptions(String authenticationScheme, String& effectiveAuthenticationScheme) at Microsoft.Identity.Web.TokenAcquisition.GetAuthenticationResultForUserAsync(IEnumerable1 scopes, String authenticationScheme, String tenantId, String userFlow, ClaimsPrincipal user, TokenAcquisitionOptions tokenAcquisitionOptions) at Microsoft.Identity.Web.DefaultAuthorizationHeaderProvider.CreateAuthorizationHeaderForUserAsync(IEnumerable1 scopes, AuthorizationHeaderProviderOptions downstreamApiOptions, ClaimsPrincipal claimsPrincipal, CancellationToken cancellationToken)

The AD part is working fine and a user can create a account and login with their Microsoft account. It is just the Graph part that is not working. Anyone any ideas? Thanks


5 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @Astech

    Have you tried configuring OpenID Connect in your appsettings.json ?

  • User Avatar
    0
    Astech created

    Hi @ismcagdas

    We don't have the OpenID section of our appsettings enabled or configured as we were under the impression this is configured through this:

    As per the instructions in approach 2 here: https://community.abp.io/posts/how-to-use-the-azure-active-directory-authentication-for-mvc-razor-page-applications-4603b9cf?_ga=2.167438713.612361716.1679501585-1726878413.1679501585

    Is this correct?

    Thank you Scott

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @Astech

    Just to confirm, is your project ABP Commercial or AspNet Zero ? Our company owns both products but they have different approaches. AspNet Zero has OpenID integration for a long time and there should be a section like below in your appsettings.json file if your project is AspNet Zero;

  • User Avatar
    0
    Astech created

    Thanks for your reply ismcagdas

    We are wanting to implement Microsoft Graph and believe this requires authenitcation through AddMicrosoftIdentityWebApp instead of OpenId does it not? We can get AD working fine and can login users. It is the Graph element that we are struggling with.

  • User Avatar
    0
    ismcagdas created
    Support Team