Programmatically Applying Security and Setting a API Server
*This section is not RapiDoc generated. It is user injected HTML/JS into a <slot> element to demonstrate how to programatically apply security keys
RapiDoc provides you with two helper methods which you can use to supply security keys programatically. You can use one of these method based on the security scheme type
SCHEME-TYPE | METHOD USED TO UPDATE |
basic | setHttpUserNameAndPassword('http-basic', 'newUserName', 'newPassword') |
other than basic | setApiKey('api_key1', 'newApiToken') |
The table below list all the scurity schemes included in this spec. Check the corrosponding method that can be used to supply an access-token
SECURITY SCHEME | SCHEME TYPE | METHOD USED TO UPDATE |
http-basic | basic | setHttpUserNameAndPassword('http-basic', 'newUserName', 'newPassword') |
http-bearer | bearer | setApiKey('http-bearer', 'newToken') |
api_key1 | (not-specified) | setApiKey('api_key1', 'newToken') |
api_key2 | (not-specified) | setApiKey('api_key2', 'newToken') |
ms-oauth | (not-specified) | setApiKey('ms-oauth', 'newToken') |
api_key_cookie | (not-specified) |
(wont work as this scheme sends api-key in a cookie, and rapidoc dont create/read cookies) |
Below form is used for taking user input and apply the security key using javascipt
Below form is used for programmatically setting the API server
Use setApiServer(serverUrl) methode to set the API Server