Hello, 

to which part of the code I should set the code? 

I have: 

 window.onload = function() {


 var protocol = location.protocol;
 var hostname = location.host;
 var context = window.location.pathname.split("/")[1];
 var href =  location.href;
 

 var api = getQueryString('api');
 
   const ui = SwaggerUIBundle({

    url: protocol + '//' + hostname + "/" + context + "/swagger/" + api + 
".json",

   dom_id: '#swagger-ui-container',
   deepLinking: true,
   validatorUrl: null,
   presets: [
       SwaggerUIBundle.presets.apis,
       SwaggerUIStandalonePreset.slice(1)
     ],
   plugins: [
       SwaggerUIBundle.plugins.DownloadUrl
     ],
   layout: "StandaloneLayout"
   })
   
   window.ui = ui
 }



Dne čtvrtek 5. února 2015 13:25:35 UTC+1 tony tam napsal(a):
>
> Authorization with username and password is simple.  Just modify your 
> index.html to set a authorization as follows:
>
>
> window.authorizations.add("basic", new PasswordAuthorization("basic", 
> username, password));
>
>
> And all your operations which either require the "basic" authorization 
> will have the header applied.
>
> On Thursday, February 5, 2015 at 2:57:27 AM UTC-8, Indraja Punna wrote:
>>
>> Any update on this. I want swagger-ui to send username and password to 
>> the api when i click on Try it out button.
>> How to do this?
>> 1. what should be added on swagger-ui side
>> 2. what extra annotations need to be added in the code?
>>
>>
>> On Tuesday, 21 May 2013 20:06:01 UTC+5:30, tony tam wrote:
>>>
>>> Hi, not yet unfortunately.  The current work-around is to enable access 
>>> to the swagger files, and secure just the API operations with headers.
>>>
>>> On Tuesday, May 21, 2013 4:32:19 AM UTC-7, Kunjan Shah wrote:
>>>>
>>>> Any updates on this issue?
>>>> I am facing the same.
>>>>
>>>> On Thursday, May 2, 2013 6:16:06 AM UTC+5:30, tony tam wrote:
>>>>>
>>>>> Sure, with any luck this'll be fixed today.
>>>>>
>>>>> On Wednesday, May 1, 2013 5:26:19 AM UTC-7, Justin Robbins wrote:
>>>>>>
>>>>>> Tony,
>>>>>>
>>>>>> Would you like me to open an issue in wordnik / swagger-ui for this?
>>>>>>
>>>>>>
>>>>>> On Tue, Apr 30, 2013 at 11:04 PM, tony tam <[email protected]> wrote:
>>>>>>
>>>>>>> OK, you've found an issue.  The swagger.js isn't sending the auth 
>>>>>>> headers, but the actual requests are.  Will post back when fixed...
>>>>>>>
>>>>>>>
>>>>>>> On Tuesday, April 30, 2013 9:57:43 AM UTC-7, tony tam wrote:
>>>>>>>>
>>>>>>>> Hi Justin, can you send me some credentials so I can test this? 
>>>>>>>>  You can email me @ fehguy _at_ gmail
>>>>>>>>
>>>>>>>> On Saturday, April 27, 2013 1:32:52 PM UTC-7, Justin Robbins wrote:
>>>>>>>>>
>>>>>>>>> Hello,
>>>>>>>>>
>>>>>>>>> I'm trying to configure swagger-ui to send a Basic Auth 
>>>>>>>>> authorization header.  I'm not have any luck so far.
>>>>>>>>>
>>>>>>>>> I've added the following swagger-ui/index.html
>>>>>>>>>
>>>>>>>>>       apiKeyName: "Authorization",    headers: {"Authorization": 
>>>>>>>>> "Basic YXBpdXNlcjphcGl1c2VycGFzc3dvcmQ=" },        
>>>>>>>>> supportHeaderParams: true,
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Firebug does not show the Authorization header getting sent and 
>>>>>>>>> the API is responding with a 401.
>>>>>>>>>
>>>>>>>>> You can take a look yourself at:
>>>>>>>>> http://socialflashcards.com/swagger-ui/index.html
>>>>>>>>>
>>>>>>>>> In case you need to see my API's swagger config, you can find it 
>>>>>>>>> here:
>>>>>>>>> https://github.com/justinhrobbins/FlashCards_App/
>>>>>>>>> tree/master/FlashCards_WebServices
>>>>>>>>>
>>>>>>>>> Not sure if it's relevant but I'm using CXF.
>>>>>>>>>
>>>>>>>>> Please let me know if there is any other info I can provide.
>>>>>>>>>
>>>>>>>>> Thanks for your assistance
>>>>>>>>>
>>>>>>>> -- 
>>>>>>> You received this message because you are subscribed to a topic in 
>>>>>>> the Google Groups "Swagger" group.
>>>>>>> To unsubscribe from this topic, visit 
>>>>>>> https://groups.google.com/d/topic/swagger-swaggersocket/OSJTzRziWzU/unsubscribe?hl=en
>>>>>>> .
>>>>>>> To unsubscribe from this group and all its topics, send an email to 
>>>>>>> [email protected].
>>>>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>>>>  
>>>>>>>  
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> -- 
>>>>>> Regards,
>>>>>> Justin Robbins
>>>>>> 973.479.0448
>>>>>> [email protected]
>>>>>>
>>>>>

-- 
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