'MicrosoftIdentityAppCallsWebApiAuthenticationBuilder' does not contain a definition for 'AddMicrosoftGraph' and no accessible extension method 'AddMicrosoftGraph'

Priya
Priya
1152 Points
33 Posts

I'm trying to create graph client to use in resource owner reset password flow in Azure AD B2C but getting following error:

'MicrosoftIdentityAppCallsWebApiAuthenticationBuilder' does not contain a definition for 'AddMicrosoftGraph' and no accessible extension method 'AddMicrosoftGraph' accepting a first argument of type 'MicrosoftIdentityAppCallsWebApiAuthenticationBuilder' could be found (are you missing a using directive or an assembly reference?)
Views: 40
Total Answered: 1
Total Marked As Answer: 0
Posted On: 08-Oct-2024 02:03

Share:   fb twitter linkedin
Answers
Smith
Smith
2850 Points
78 Posts
         

I think you are missing package import. To use Graph API in asp.net core project you should add nuget Microsoft.Identity.Web.MicrosoftGraph (for v1.0) or Microsoft.Identity.Web.MicrosoftGraphBeta (for beta version).

In ConfigureServices add this:

services.AddMicrosoftIdentityWebAppAuthentication(Configuration)
    .EnableTokenAcquisitionToCallDownstreamApi()
    .AddMicrosoftGraph()
    .AddInMemoryTokenCaches();
Posted On: 10-Oct-2024 04:44
 Log In to Chat