{"action":"created","issue":{"url":"https://api.github.com/repos/swagger-api/swagger-js/issues/1036","repository_url":"https://api.github.com/repos/swagger-api/swagger-js","labels_url":"https://api.github.com/repos/swagger-api/swagger-js/issues/1036/labels{/name}","comments_url":"https://api.github.com/repos/swagger-api/swagger-js/issues/1036/comments","events_url":"https://api.github.com/repos/swagger-api/swagger-js/issues/1036/events","html_url":"https://github.com/swagger-api/swagger-js/issues/1036","id":225573869,"number":1036,"title":"Using apiKey authorization with client V3.0 (try on Uber client)","user":{"login":"mat250","id":7283267,"avatar_url":"https://avatars2.githubusercontent.com/u/7283267?v=4","gravatar_id":"","url":"https://api.github.com/users/mat250","html_url":"https://github.com/mat250","followers_url":"https://api.github.com/users/mat250/followers","following_url":"https://api.github.com/users/mat250/following{/other_user}","gists_url":"https://api.github.com/users/mat250/gists{/gist_id}","starred_url":"https://api.github.com/users/mat250/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mat250/subscriptions","organizations_url":"https://api.github.com/users/mat250/orgs","repos_url":"https://api.github.com/users/mat250/repos","events_url":"https://api.github.com/users/mat250/events{/privacy}","received_events_url":"https://api.github.com/users/mat250/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-05-02T02:18:19Z","updated_at":"2017-08-15T15:27:43Z","closed_at":null,"body":"Hi, \r\n\r\nI'm trying to use the client authorization for the Uber API using Swagger client 3.0, but I don't succeed to inject properly the authorization inside the request's header.\r\nThe result is always a 401 : `\"{\"message\":\"No authentication provided.\",\"code\":\"unauthorized\"}\"`\r\n\r\nHere the code that I'm using and the description of the Uber's API : \r\n\r\n```\r\nSwagger('http://localhost:8080/swagger/uber.json').then(client => {\r\n      client.spec; // The resolved spec\r\n      client.originalSpec; // In case you need it\r\n      client.errors; // Any resolver errors\r\n\r\n      //TryItOut\r\n      const params = {\r\n        spec: client.spec,\r\n\r\n        pathName: '/estimates/price',\r\n        method: 'get',\r\n        parameters: { start_latitude: 48.8272089, start_longitude: 2.2859614, end_latitude: 48.844271, end_longitude: 2.341923 },\r\n\r\n        securities: {apiKey: 'Token [Uber API Token]'}, \r\n        requestContentType :'application/json', \r\n        responseContentType: 'application/json'\r\n\r\n        //(http),\r\n      }\r\n\r\n      Swagger.execute(params).then((res) => {\r\n        console.log(res);\r\n      }).catch((err) => {\r\n        console.log(err);\r\n      })\r\n    });\r\n```\r\n\r\nHere the Uber API Swagger file I'm using : \r\n```\r\n{\r\n  \"swagger\": \"2.0\",\r\n  \"info\": {\r\n    \"title\": \"Uber API\",\r\n    \"description\": \"Move your app forward with the Uber API\",\r\n    \"version\": \"1.0.0\"\r\n  },\r\n  \"host\": \"api.uber.com\",\r\n  \"schemes\": [\r\n    \"https\"\r\n  ],\r\n  \"basePath\": \"/v1\",\r\n  \"produces\": [\r\n    \"application/json\"\r\n  ],\r\n  \"securityDefinitions\": {\r\n    \"apiAuthorization\": {\r\n      \"description\": \"For accessing the API a valid JWT token must be passed in all the queries in\\nthe 'Authorization' header.\\nA valid JWT token is generated by the API and retourned as answer of a call\\nto the route /login giving a valid user & password.\\nThe following syntax must be used in the 'Authorization' header.\\n\",\r\n      \"type\": \"apiKey\",\r\n      \"name\": \"Authorization\",\r\n      \"in\": \"header\"\r\n    }\r\n  },\r\n  \"paths\": {\r\n    \"/products\": {\r\n      \"get\": {\r\n        \"summary\": \"Product Types\",\r\n        \"description\": \"The Products endpoint returns information about the *Uber* products\\noffered at a given location. The response includes the display name\\nand other details about each product, and lists the products in the\\nproper display order.\\n\",\r\n        \"parameters\": [\r\n          {\r\n            \"name\": \"latitude\",\r\n            \"in\": \"query\",\r\n            \"description\": \"Latitude component of location.\",\r\n            \"required\": true,\r\n            \"type\": \"number\",\r\n            \"format\": \"double\"\r\n          },\r\n          {\r\n            \"name\": \"longitude\",\r\n            \"in\": \"query\",\r\n            \"description\": \"Longitude component of location.\",\r\n            \"required\": true,\r\n            \"type\": \"number\",\r\n            \"format\": \"double\"\r\n          }\r\n        ],\r\n        \"tags\": [\r\n          \"Products\"\r\n        ],\r\n        \"responses\": {\r\n          \"200\": {\r\n            \"description\": \"An array of products\",\r\n            \"schema\": {\r\n              \"type\": \"array\",\r\n              \"items\": {\r\n                \"$ref\": \"#/definitions/Product\"\r\n              }\r\n            }\r\n          },\r\n          \"default\": {\r\n            \"description\": \"Unexpected error\",\r\n            \"schema\": {\r\n              \"$ref\": \"#/definitions/Error\"\r\n            }\r\n          }\r\n        }\r\n      }\r\n    },\r\n    \"/estimates/price\": {\r\n      \"get\": {\r\n        \"summary\": \"Price Estimates\",\r\n        \"description\": \"The Price Estimates endpoint returns an estimated price range\\nfor each product offered at a given location. The price estimate is\\nprovided as a formatted string with the full price range and the localized\\ncurrency symbol.<br><br>The response also includes low and high estimates,\\nand the [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code for\\nsituations requiring currency conversion. When surge is active for a particular\\nproduct, its surge_multiplier will be greater than 1, but the price estimate\\nalready factors in this multiplier.\\n\",\r\n        \"parameters\": [\r\n          {\r\n            \"name\": \"start_latitude\",\r\n            \"in\": \"query\",\r\n            \"description\": \"Latitude component of start location.\",\r\n            \"required\": true,\r\n            \"type\": \"number\",\r\n            \"format\": \"double\"\r\n          },\r\n          {\r\n            \"name\": \"start_longitude\",\r\n            \"in\": \"query\",\r\n            \"description\": \"Longitude component of start location.\",\r\n            \"required\": true,\r\n            \"type\": \"number\",\r\n            \"format\": \"double\"\r\n          },\r\n          {\r\n            \"name\": \"end_latitude\",\r\n            \"in\": \"query\",\r\n            \"description\": \"Latitude component of end location.\",\r\n            \"required\": true,\r\n            \"type\": \"number\",\r\n            \"format\": \"double\"\r\n          },\r\n          {\r\n            \"name\": \"end_longitude\",\r\n            \"in\": \"query\",\r\n            \"description\": \"Longitude component of end location.\",\r\n            \"required\": true,\r\n            \"type\": \"number\",\r\n            \"format\": \"double\"\r\n          }\r\n        ],\r\n        \"tags\": [\r\n          \"Estimates\"\r\n        ],\r\n        \"security\": [\r\n          {\r\n            \"apiAuthorization\": []\r\n          }\r\n        ],\r\n        \"responses\": {\r\n          \"200\": {\r\n            \"description\": \"An array of price estimates by product\",\r\n            \"schema\": {\r\n              \"type\": \"array\",\r\n              \"items\": {\r\n                \"$ref\": \"#/definitions/PriceEstimate\"\r\n              }\r\n            }\r\n          },\r\n          \"default\": {\r\n            \"description\": \"Unexpected error\",\r\n            \"schema\": {\r\n              \"$ref\": \"#/definitions/Error\"\r\n            }\r\n          }\r\n        }\r\n      }\r\n    },\r\n    \"/estimates/time\": {\r\n      \"get\": {\r\n        \"summary\": \"Time Estimates\",\r\n        \"description\": \"The Time Estimates endpoint returns ETAs for all products offered at a given location, with the responses expressed as integers in seconds. We recommend that this endpoint be called every minute to provide the most accurate, up-to-date ETAs.\",\r\n        \"parameters\": [\r\n          {\r\n            \"name\": \"start_latitude\",\r\n            \"in\": \"query\",\r\n            \"description\": \"Latitude component of start location.\",\r\n            \"required\": true,\r\n            \"type\": \"number\",\r\n            \"format\": \"double\"\r\n          },\r\n          {\r\n            \"name\": \"start_longitude\",\r\n            \"in\": \"query\",\r\n            \"description\": \"Longitude component of start location.\",\r\n            \"required\": true,\r\n            \"type\": \"number\",\r\n            \"format\": \"double\"\r\n          },\r\n          {\r\n            \"name\": \"customer_uuid\",\r\n            \"in\": \"query\",\r\n            \"type\": \"string\",\r\n            \"format\": \"uuid\",\r\n            \"description\": \"Unique customer identifier to be used for experience customization.\"\r\n          },\r\n          {\r\n            \"name\": \"product_id\",\r\n            \"in\": \"query\",\r\n            \"type\": \"string\",\r\n            \"description\": \"Unique identifier representing a specific product for a given latitude & longitude.\"\r\n          }\r\n        ],\r\n        \"tags\": [\r\n          \"Estimates\"\r\n        ],\r\n        \"responses\": {\r\n          \"200\": {\r\n            \"description\": \"An array of products\",\r\n            \"schema\": {\r\n              \"type\": \"array\",\r\n              \"items\": {\r\n                \"$ref\": \"#/definitions/Product\"\r\n              }\r\n            }\r\n          },\r\n          \"default\": {\r\n            \"description\": \"Unexpected error\",\r\n            \"schema\": {\r\n              \"$ref\": \"#/definitions/Error\"\r\n            }\r\n          }\r\n        }\r\n      }\r\n    },\r\n    \"/me\": {\r\n      \"get\": {\r\n        \"summary\": \"User Profile\",\r\n        \"description\": \"The User Profile endpoint returns information about the Uber user that has authorized with the application.\",\r\n        \"tags\": [\r\n          \"User\"\r\n        ],\r\n        \"responses\": {\r\n          \"200\": {\r\n            \"description\": \"Profile information for a user\",\r\n            \"schema\": {\r\n              \"$ref\": \"#/definitions/Profile\"\r\n            }\r\n          },\r\n          \"default\": {\r\n            \"description\": \"Unexpected error\",\r\n            \"schema\": {\r\n              \"$ref\": \"#/definitions/Error\"\r\n            }\r\n          }\r\n        }\r\n      }\r\n    },\r\n    \"/history\": {\r\n      \"get\": {\r\n        \"summary\": \"User Activity\",\r\n        \"description\": \"The User Activity endpoint returns data about a user's lifetime activity with Uber. The response will include pickup locations and times, dropoff locations and times, the distance of past requests, and information about which products were requested.<br><br>The history array in the response will have a maximum length based on the limit parameter. The response value count may exceed limit, therefore subsequent API requests may be necessary.\",\r\n        \"parameters\": [\r\n          {\r\n            \"name\": \"offset\",\r\n            \"in\": \"query\",\r\n            \"type\": \"integer\",\r\n            \"format\": \"int32\",\r\n            \"description\": \"Offset the list of returned results by this amount. Default is zero.\"\r\n          },\r\n          {\r\n            \"name\": \"limit\",\r\n            \"in\": \"query\",\r\n            \"type\": \"integer\",\r\n            \"format\": \"int32\",\r\n            \"description\": \"Number of items to retrieve. Default is 5, maximum is 100.\"\r\n          }\r\n        ],\r\n        \"tags\": [\r\n          \"User\"\r\n        ],\r\n        \"responses\": {\r\n          \"200\": {\r\n            \"description\": \"History information for the given user\",\r\n            \"schema\": {\r\n              \"$ref\": \"#/definitions/Activities\"\r\n            }\r\n          },\r\n          \"default\": {\r\n            \"description\": \"Unexpected error\",\r\n            \"schema\": {\r\n              \"$ref\": \"#/definitions/Error\"\r\n            }\r\n          }\r\n        }\r\n      }\r\n    }\r\n  },\r\n  \"definitions\": {\r\n    \"Product\": {\r\n      \"type\": \"object\",\r\n      \"properties\": {\r\n        \"product_id\": {\r\n          \"type\": \"string\",\r\n          \"description\": \"Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles.\"\r\n        },\r\n        \"description\": {\r\n          \"type\": \"string\",\r\n          \"description\": \"Description of product.\"\r\n        },\r\n        \"display_name\": {\r\n          \"type\": \"string\",\r\n          \"description\": \"Display name of product.\"\r\n        },\r\n        \"capacity\": {\r\n          \"type\": \"string\",\r\n          \"description\": \"Capacity of product. For example, 4 people.\"\r\n        },\r\n        \"image\": {\r\n          \"type\": \"string\",\r\n          \"description\": \"Image URL representing the product.\"\r\n        }\r\n      }\r\n    },\r\n    \"PriceEstimate\": {\r\n      \"type\": \"object\",\r\n      \"properties\": {\r\n        \"product_id\": {\r\n          \"type\": \"string\",\r\n          \"description\": \"Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles\"\r\n        },\r\n        \"currency_code\": {\r\n          \"type\": \"string\",\r\n          \"description\": \"[ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code.\"\r\n        },\r\n        \"display_name\": {\r\n          \"type\": \"string\",\r\n          \"description\": \"Display name of product.\"\r\n        },\r\n        \"estimate\": {\r\n          \"type\": \"string\",\r\n          \"description\": \"Formatted string of estimate in local currency of the start location. Estimate could be a range, a single number (flat rate) or \\\"Metered\\\" for TAXI.\"\r\n        },\r\n        \"low_estimate\": {\r\n          \"type\": \"number\",\r\n          \"description\": \"Lower bound of the estimated price.\"\r\n        },\r\n        \"high_estimate\": {\r\n          \"type\": \"number\",\r\n          \"description\": \"Upper bound of the estimated price.\"\r\n        },\r\n        \"surge_multiplier\": {\r\n          \"type\": \"number\",\r\n          \"description\": \"Expected surge multiplier. Surge is active if surge_multiplier is greater than 1. Price estimate already factors in the surge multiplier.\"\r\n        }\r\n      }\r\n    },\r\n    \"Profile\": {\r\n      \"type\": \"object\",\r\n      \"properties\": {\r\n        \"first_name\": {\r\n          \"type\": \"string\",\r\n          \"description\": \"First name of the Uber user.\"\r\n        },\r\n        \"last_name\": {\r\n          \"type\": \"string\",\r\n          \"description\": \"Last name of the Uber user.\"\r\n        },\r\n        \"email\": {\r\n          \"type\": \"string\",\r\n          \"description\": \"Email address of the Uber user\"\r\n        },\r\n        \"picture\": {\r\n          \"type\": \"string\",\r\n          \"description\": \"Image URL of the Uber user.\"\r\n        },\r\n        \"promo_code\": {\r\n          \"type\": \"string\",\r\n          \"description\": \"Promo code of the Uber user.\"\r\n        }\r\n      }\r\n    },\r\n    \"Activity\": {\r\n      \"type\": \"object\",\r\n      \"properties\": {\r\n        \"uuid\": {\r\n          \"type\": \"string\",\r\n          \"description\": \"Unique identifier for the activity\"\r\n        }\r\n      }\r\n    },\r\n    \"Activities\": {\r\n      \"type\": \"object\",\r\n      \"properties\": {\r\n        \"offset\": {\r\n          \"type\": \"integer\",\r\n          \"format\": \"int32\",\r\n          \"description\": \"Position in pagination.\"\r\n        },\r\n        \"limit\": {\r\n          \"type\": \"integer\",\r\n          \"format\": \"int32\",\r\n          \"description\": \"Number of items to retrieve (100 max).\"\r\n        },\r\n        \"count\": {\r\n          \"type\": \"integer\",\r\n          \"format\": \"int32\",\r\n          \"description\": \"Total number of items available.\"\r\n        },\r\n        \"history\": {\r\n          \"type\": \"array\",\r\n          \"items\": {\r\n            \"$ref\": \"#/definitions/Activity\"\r\n          }\r\n        }\r\n      }\r\n    },\r\n    \"Error\": {\r\n      \"type\": \"object\",\r\n      \"properties\": {\r\n        \"code\": {\r\n          \"type\": \"integer\",\r\n          \"format\": \"int32\"\r\n        },\r\n        \"message\": {\r\n          \"type\": \"string\"\r\n        },\r\n        \"fields\": {\r\n          \"type\": \"string\"\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\nThanks a lot guys for your help, because this tool is really amazing 😄 \r\n\r\nMat"},"comment":{"url":"https://api.github.com/repos/swagger-api/swagger-js/issues/comments/322501203","html_url":"https://github.com/swagger-api/swagger-js/issues/1036#issuecomment-322501203","issue_url":"https://api.github.com/repos/swagger-api/swagger-js/issues/1036","id":322501203,"user":{"login":"mat250","id":7283267,"avatar_url":"https://avatars2.githubusercontent.com/u/7283267?v=4","gravatar_id":"","url":"https://api.github.com/users/mat250","html_url":"https://github.com/mat250","followers_url":"https://api.github.com/users/mat250/followers","following_url":"https://api.github.com/users/mat250/following{/other_user}","gists_url":"https://api.github.com/users/mat250/gists{/gist_id}","starred_url":"https://api.github.com/users/mat250/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mat250/subscriptions","organizations_url":"https://api.github.com/users/mat250/orgs","repos_url":"https://api.github.com/users/mat250/repos","events_url":"https://api.github.com/users/mat250/events{/privacy}","received_events_url":"https://api.github.com/users/mat250/received_events","type":"User","site_admin":false},"created_at":"2017-08-15T15:27:43Z","updated_at":"2017-08-15T15:27:43Z","body":"Thanks @c4milo , I'll check that :)"}}
{"actor":{"display_login":"mat250"}}