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:
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(IEnumerable
1 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)
-
0
Hi @Astech
Have you tried configuring OpenID Connect in your appsettings.json ?
-
0
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
-
0
-
0
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.
-
0
Hi,
Unfortunately I don't have experience with Microsoft Graph, maybe this article can help you https://learn.microsoft.com/en-us/samples/microsoftgraph/aspnetcore-connect-sample/microsoft-graph-connect-sample-for-aspnet-core-31/?source=recommendations