SecurityRequirementsOperationFilter不起作用

时间:2019-10-15 12:43:11

标签: .net-core swagger swashbuckle

我想添加有关调用WebAPI的必要身份验证的说明,然后尝试做:

docData.forEach((item)=>{
   firestore().collection('timeSlot')
              .where('docId','==', item)
              .get()
              .then(function(doc) {
                     doc.forEach(function(docV) {
                         console.log("Slot data", docV.data());
                     });
              });
});

但是我得到一个错误:

  

未获取错误/swagger/v1/swagger.json

如果我删除此行:

        services.AddSwaggerGen(c =>
        {
            c.SwaggerDoc("v1", new Info
            {
                Title = "Tablet Management",
                Version = "v1",
                Contact = new Contact
                {
                    Name = "Oleg Shastitko",
                    Email = "oshastitko@3mdsolutions.com"
                },
            });

            c.AddSecurityDefinition("oauth2", new ApiKeyScheme
            {
                Description = "Standard Authorization header using the Bearer scheme. Example: \"bearer {token}\"",
                In = "header",
                Name = "Authorization",
                Type = "apiKey"
            });
            c.OperationFilter<SecurityRequirementsOperationFilter>();

它有效,但是没有我想要的。如何解决?

0 个答案:

没有答案