How to add default value to authorization header value

Viewed 1537

I am using asp.netcore 3.1 and openapi 3.0.1

I have added authorization to my apis using the following code:

services.AddSwaggerGen(setupAction =>
        {
            setupAction.SwaggerDoc("APIs_Documentation", new OpenApiInfo
            {
                Title = "Project APIs",
                Version = "1"
            });

            setupAction.AddSecurityDefinition("oauth2", new OpenApiSecurityScheme()
            {
                Type = SecuritySchemeType.Http,
                Scheme = "bearer",
                Description = "Enter token here",
                Name = "Authorization",
                @In = ParameterLocation.Header,

            });
            setupAction.AddSecurityRequirement(new OpenApiSecurityRequirement
            {
                {
                    new OpenApiSecurityScheme
                    {
                        Reference = new OpenApiReference
                        {
                        Type = ReferenceType.SecurityScheme,
                        Id = "oauth2",

                        }
                    },new List<string>()}
        });
        });

Is there any way to set a default value to the value field of the popup authorization dialogue in the next image?

enter image description here

0 Answers
Related