I'm using grape
, grape-swagger
, and grape-swagger-rails
to set up an API for my Rails 4.2.1 project. It's going to be an internal API, so I want developers to be able to access it, but not the general public. What's the best way to do that?
My initial idea was to take advantage of the api_key
field that you can set in swagger-ui
, but I can't figure out the right way to access it inside the root API generator for Grape.
I also thought I could try to only mount the endpoint for the documentation if the user is an admin (we're using Devise), but that doesn't hide the documentation itself (if someone knows the swagger.json
link).
How have people dealt with this problem in the past?