Also the Curl is created correct as below;

CURL created as;

curl -X GET --header 'Accept: application/json' --header 'token: 
ffsdfsdffsfdffsdfsdfsdf' 
'https://10.x.1.x/iot/bs/api/v1/GetConfig?sensorId=6'

;/

On Tuesday, 19 July 2016 09:26:23 UTC-4, Hitendrasinh Mahida wrote:
>
>
> Hi,
> Here is part of yaml file;
>
>
> securityDefinitions:
>   key:
>     type: "apiKey"
>     in: "header"
>     name: "token"
>   
> host: "10.x.1.x"
>
> basePath: "/a/bs/api/v1"
> schemes:
> - "https"
> produces:
> - "application/json"
>
> paths:
>   /GetConfig:
>     get:
>       tags:
>       - "Devices"
>       security:
>         - key: []
>       summary: "Get Device Config"
>       description: "Information about the current configurations for 
> device."
>      
>       parameters:
> .
> .
> .
>
> And I use ;
>
> swaggerUi.api.clientAuthorizations.add("key", new 
> SwaggerClient.ApiKeyAuthorization("token", bearerToken, "header"));
>
> my request Header sent is as;
>
>
>    1. OPTIONS /a/bs/api/v1/GetConfig?Id=6 HTTP/1.1 Host: :84.410.240.1 
>    Connection: keep-alive Access-Control-Request-Method: GET Origin: 
>    http://localhost:8080 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; 
>    x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 
>    Safari/537.36 Access-Control-Request-Headers: accept, token Accept: */* 
>    Referer: http://localhost:8080/ Accept-Encoding 
>    <http://localhost:8080/Accept-Encoding>: gzip, deflate, sdch, br 
>    Accept-Language: en-GB,en-US;q=0.8,en;q=0.6
>
> Thanks!
>
>
> On Thursday, 7 July 2016 13:25:13 UTC-4, tony tam wrote:
>>
>> Hmm. Well, the header is only added if it meets the security 
>> requirements, meaning there are no security elements defined, or they don’t 
>> match.  Please share your JSON or YAML definition and we can look into it.
>>
>> On Jul 6, 2016, at 9:57 AM, Hitendrasinh Mahida <[email protected]> 
>> wrote:
>>
>>
>>    - swagger-ui version 2.0
>>    - a swagger file reproducing the issue : index.html
>>
>> I am trying to add header named 'token' for each api call as;
>>
>>
>> swaggerUi.api.clientAuthorizations.add("key1", new 
>> SwaggerClient.ApiKeyAuthorization("token", "bearerToken", "header"));
>>
>>
>> But I do not receive that header on server, also inspecting request 
>> header in browser is not showing that newly added header, it just send 
>> standard default headers.
>>
>>
>> But, swagger info message for the curl request for the same shows the 
>> header I added.
>>
>>
>> What could be the reason?
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Swagger" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to