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

Priya
Priya
1194 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: 195
Total Answered: 2
Total Marked As Answer: 1
Posted On: 08-Oct-2024 02:03

Share:   fb twitter linkedin
Answers
Smith
Smith
2890 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
thanks.
 - Priya  17-Oct-2024 21:42
Priya
Priya
1194 Points
33 Posts
         

Thanks, it was worked as some package related issue resolved.

Posted On: 17-Oct-2024 21:42
 Log In to Chat