You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can dynamically set `app_url` for each request use a `before_filter_proc`:
51
52
@@ -101,6 +102,16 @@ Now you can specify the username and password to your API in the Swagger "API ke
101
102
The javascript that loads on the Swagger page automatically encodes the username and password and adds the authorization header to your API request.
102
103
See the official Swagger documentation about [Custom Header Parameters](https://github.com/wordnik/swagger-ui#custom-header-parameters---for-basic-auth-etc)
103
104
105
+
### Pre-fill Authentication
106
+
107
+
If you will know the Authentication key prior to page load or you wish to set it for debug purposes, you can setup so that the `api_key` field is pre-filled on page load:
To set it based on the `current_user` or other request-based parameters, try using it inside of your `before_filter` (See Swagger UI Authorization)
114
+
104
115
### API Token Authentication
105
116
106
117
If your application uses token authentication passed as a query param, you can setup Swagger to send the API token along with each request to your API:
@@ -124,6 +135,22 @@ GrapeSwaggerRails.options.before_filter do |request|
124
135
end
125
136
```
126
137
138
+
### Hiding the API or Authorization text boxes
139
+
140
+
If you know in advance that you would like to prevent changing the Swagger API URL, you can hide it using the following:
141
+
142
+
```ruby
143
+
GrapeSwaggerRails.options.hide_url_input =true
144
+
```
145
+
146
+
Similarly, you can hide the Authentication input box by adding this:
To update Swagger UI from its [distribution](https://github.com/wordnik/swagger-ui), run `bundle exec rake swagger_ui:dist:update`. Examine the changes carefully.
0 commit comments