Contributions
Re: JTW token is not getting passed in Swagger-ui
HKosova Yay! Finally solved it. Thank you so much. So here's what I did. I imported my swagger.json to this editor you linked so it automatically converted to .yml and then added security: - ApiKeyAuth: [] as per your suggestion. Finally downloaded it by converting to .json. Pasted the code in my project and everything worked. Thanks again.2.8KViews1like0CommentsRe: JTW token is not getting passed in Swagger-ui
HKosovaI looked into that editor, but it looks like this is using .yaml only. I pasted my swagger.json on the editor and it showed an error, "security should be an array". Here's the complete code. How should I modify the security field? { "swagger":"2.0", "info":{ "version":"1.0.0", "title":"Magic8ballAppAPI", "description":"FindouthowyourAPIswork", "license":{ "name":"MIT", "url":"https://opensource.org/licenses/MIT" } }, "host":"localhost:3000", "tags":[ { "name":"Users", "description":"APIforusersinthesystem" } ], "schemes":[ "http", "https" ], "consumes":[ "application/json" ], "produces":[ "application/json" ], "securityDefinitions":{ "ApiKeyAuth":{ "type":"apiKey", "name":"Authorization", "in":"header" } }, "security":{ "ApiKeyAuth":[] }, "paths":{ "/api/eight-ball/user/login":{ "post":{ "summary":"Loginuser", "tags":[ "Users" ], "description":"Loginuserinsystem", "parameters":[ { "name":"user", "in":"body", "description":"Loginuser", "schema":{ "$ref":"#/definitions/User" } } ], "produces":[ "application/json" ], "responses":{ "200":{ "description":"LoginSuccess", "schema":{ "$ref":"#/definitions/User" } }, "401":{ "description":"Logindetailsarenotvalid!!" }, "404":{ "description":"Emailisnotregistered!" }, "500":{ "description":"Userloginfailed!!" } } } } }, "definitions":{ "User":{ "properties":{ "email":{ "type":"string" }, "password":{ "type":"string" } } }, "userEmail":{ "properties":{ "email":{ "type":"string" } } } } } The relevant code at node js: constswaggerDocument=require('./swagger.json'); constswaggerUi=require('swagger-ui-express'); app.use('/api-docs',swaggerUi.serve,swaggerUi.setup(swaggerDocument));2.8KViews0likes2CommentsRe: JTW token is not getting passed in Swagger-ui
HeyHKosova thanks for the reply. Looks like I'm missing something more here. When I added the field and hit execute, the UI keeps on showing the loader, this is what I'm getting on console.: system.js:464 TypeError: f.forEach is not a function at t.request (build-request.js:81) at fn (build-request.js:15) at Object.gn [as buildRequest] (index.js:249) at actions.js:428 at Object.dispatch (utils.js:195) at dispatch (<anonymous>:1:28545) at redux.js:477 at wrap-actions.js:33 at Object.r (system.js:174) at Object.executeRequest (system.js:461)2.8KViews0likes4Comments