I am new to swagger.
We already have an API, so I'm trying to manually write swagger.yaml
So far I have figured out how to make my route / login and return the JWT in response.
But I'm not sure how to move on. Is it possible to automatically connect the returned JWT to subsequent calls?
Or do I need to manually copy and paste the returned JWT?
If I have to do it manually .. then .. ahh .. how?
An Authenticate button appears in the swagger editor, and I can click it and get the input box that apikey is looking for ...
But this is not the same when viewing the swagger user interface ... when I go to localhost to see the swagger user interface, I do not get the authentication button and cannot insert the JWT text ...
My swagger.yaml is as follows:
swagger: "2.0" info: version: 1.0.0 title: Identity Management Service description: API to allow JWT authentication and authorisation termsOfService: http:
Obviously, I would prefer to use it so that the response token from the / login call is saved and used in / getUsers ...
The response from calling / login is as follows:
{ "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0eXBlIjoidXNlciIsInVzZXJpZCI6InBqbWVhbHkiLCJlbWFpbCI6InBqbWVhbHlAZ21haWwuY29tIiwiZmlyc3RuYW1lIjoiUEoiLCJsYXN0bmFtZSI6Ik1lYWx5Iiwib3JnIjoib3JnMSIsInRlYW1zIjpbInRlYW0xIl0sImFjbCI6WyJlbXBsb3llZSIsInRlYW1MZWFkIl0sInRva2VuVHlwZSI6IndlYkFwcFRva2VuIiwidG9rZW5WZXJzaW9uIjoiMSIsImlhdCI6MTQ2NzkxMDkyNSwiZXhwIjoxNDY3OTk3MzI1fQ.e4Trk-0kDoid5Xr9BQ5ZP_HMBN2l8_G2pn7ac2tt4uE", "user": { "type": "user", "userid": "joebloggs", "email": " joe@bloggs.com ", "firstname": "Joe", "lastname": "Bloggs", "org": "org1", "teams": [ "team1" ], "acl": [ "employee", "teamLead" ], "tokenType": "webAppToken", "tokenVersion": "1", "iat": 1467910925, "exp": 1467997325 } } ", { "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0eXBlIjoidXNlciIsInVzZXJpZCI6InBqbWVhbHkiLCJlbWFpbCI6InBqbWVhbHlAZ21haWwuY29tIiwiZmlyc3RuYW1lIjoiUEoiLCJsYXN0bmFtZSI6Ik1lYWx5Iiwib3JnIjoib3JnMSIsInRlYW1zIjpbInRlYW0xIl0sImFjbCI6WyJlbXBsb3llZSIsInRlYW1MZWFkIl0sInRva2VuVHlwZSI6IndlYkFwcFRva2VuIiwidG9rZW5WZXJzaW9uIjoiMSIsImlhdCI6MTQ2NzkxMDkyNSwiZXhwIjoxNDY3OTk3MzI1fQ.e4Trk-0kDoid5Xr9BQ5ZP_HMBN2l8_G2pn7ac2tt4uE", "user": { "type": "user", "userid": "joebloggs", "email": " joe@bloggs.com ", "firstname": "Joe", "lastname": "Bloggs", "org": "org1", "teams": [ "team1" ], "acl": [ "employee", "teamLead" ], "tokenType": "webAppToken", "tokenVersion": "1", "iat": 1467910925, "exp": 1467997325 } }
source share