Skip to content

Commit 4799001

Browse files
committed
Updated README.md
Documented authenticating to an API that requires a token sent via URL params.
1 parent e476b18 commit 4799001

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,16 @@ Now you can specify the username and password to your API in the Swagger "API ke
6060
The javascript that loads on the Swagger page automatically encodes the username and password and adds the authorization header to your API request.
6161
See the official Swagger documentation about [Custom Header Parameters](https://github.com/wordnik/swagger-ui#custom-header-parameters---for-basic-auth-etc)
6262

63+
### API Token Authentication
64+
65+
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:
66+
67+
```ruby
68+
GrapeSwaggerRails.options.api_key_name = 'api_token'
69+
GrapeSwaggerRails.options.api_key_type = 'query'
70+
```
71+
72+
You can use the ```api_key``` input box to fill in your API token.
6373
### Swagger UI Authorization
6474

6575
You may want to authenticate users before displaying the Swagger UI, particularly when the API is protected by Basic Authentication.

0 commit comments

Comments
 (0)