6

I a trying to set up google sign in in my .net core web api application. I have been following this guide: https://learn.microsoft.com/en-us/aspnet/core/security/authentication/social/google-logins

But for some reason i get this error:

'IConfigurationBuilder' does not contain a definition for 'AddUserSecrets' and no extension method 'AddUserSecrets' accepting a first argument of type 'IConfigurationBuilder' could be found (are you missing a using directive or an assembly reference?)

Here's my startup method, nothing special here:

public Startup(IHostingEnvironment env)
{
    var builder = new ConfigurationBuilder()
        .SetBasePath(env.ContentRootPath)
        .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
        .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);

    if (env.IsDevelopment())
    {
        // For more details on using the user secret store see http://go.microsoft.com/fwlink/?LinkID=532709
        builder.AddUserSecrets<Startup>();
    }

    builder.AddEnvironmentVariables();
    Configuration = builder.Build();
}

1 Answer 1

10

You need to add the relevant package to use it. The package is called Microsoft.Extensions.Configuration.UserSecrets, you can learn more about it here.

Sign up to request clarification or add additional context in comments.

1 Comment

Huh, i dont know how i missed that. Thanks!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.