How to prefill API key for swagger UI
See original GitHub issueI’m using:
- Rails 4.2.6
- Grape, Win Bouncer, Doorkeeper
How can I pre-fill API key for logged in user for swagger UI? The only way I figured out how to get the current token is by creating on separate rails app as an OauthClient. However, for convenience and in production I would like to prefill the api key in swagger UI. Or how can a logged in user get the api key easily?
wine_bouncer.rb:
WineBouncer.configure do |config|
config.auth_strategy = :swagger
config.define_resource_owner do
User.find(doorkeeper_access_token.resource_owner_id) if doorkeeper_access_token
end
end
swagger.rb:
GrapeSwaggerRails.options.url = '/api/mobile/swagger_doc.json'
GrapeSwaggerRails.options.app_url = 'https://www.domain.com'
GrapeSwaggerRails.options.api_key_name = 'access_token'
GrapeSwaggerRails.options.api_key_type = 'query'
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
API Keys - Swagger
Some APIs use API keys for authorization. An API key is a token that a client provides when making API calls. The key...
Read more >Adding Basic Authorization for Swagger-UI - Stack Overflow
In Swagger UI 3.13.0+, you can use the preauthorizeBasic method to pre-fill the Basic auth username and password for "try it out" calls....
Read more >Web Component based Swagger & OpenAPI Spec ... - RapiDoc
Attributes ; api-key-value, Value of the API key that will be send while trying out the APIs. This can also be provided/overwritten from...
Read more >Deposit Sign API v1 OAS3
Swagger UI. Select a definition. API V1 ... /swagger-api-doc/v1/swagger.json ... Get a pre-filled key application by CompanyCode and PersonalCode.
Read more >App APIs - Airkit
Once the token has been created in the Console, go to Settings and add the API Key in API Key Filtering. This will...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I created a pull request to update the README.
Thanks @nhinze