Skip to content

'Configuration' keyword is giving error #3

Open

Description

@paramita2000

I am using asp.net core 6.0. In Step 2, 'Configuration' keyword giving error. It is showing this error - "The name 'Configuration' does not exist in the current context"
what can I do to resolve this ?

Activity

  1. djm30 commented on Jun 23, 2022

    @djm30

    I'm having the same issue, did you ever get it sorted?

  2. saulo-valdivia-v commented on Jan 11, 2023

    @saulo-valdivia-v

    I tried with this in Program.cs file and it worked for me using .NET 6

                builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
                    .AddJwtBearer(options =>
                    {
                        options.TokenValidationParameters = new TokenValidationParameters
                        {
                            ValidateIssuer = true,
                            ValidateAudience = true,
                            ValidateLifetime = true,
                            ValidateIssuerSigningKey = true,
                            ValidIssuer = builder.Configuration["Tokens:Issuer"],
                            ValidAudience = builder.Configuration["Tokens:Issuer"],
                            IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(builder.Configuration["Tokens:Key"])),
                            ClockSkew = TimeSpan.Zero
                        };
                    });
    

    Hope it helps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions