Replies: 1 comment 1 reply
-
Hi, I think Swagger already has the implementation of bearer auth. So your use case can be resolved following these steps:
config.swagger_docs = {
'v1/swagger.yaml' => {
# ...
components: {
securitySchemes: {
bearerAuth: { type: 'http', scheme: 'bearer' } },
# ...
}
}
}
path '/api/v1/users/me' do
get 'Who am I?' do
tags 'Users'
consumes 'application/json'
security [bearerAuth: []] # <-- HERE
response '200', 'Get the User' do
# ...
let(:access_token) { "GET_THE_ACCESS_TOKEN_SOMEWHERE" }
let(:Authorization) { "Bearer #{access_token}" }
run_test!
end
end
end That's all. run Clicking on that button this dialog will appear: Hope it helps to anyone in the future :) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
My goal is using authorization token to use the
Execute
functionality in the generated API docsthe way how I am doing this (not documented as I see)
parameter name: :Authorization, in: :header, type: :string, required: true, value: 'Bearer: 23456'
value
?curl
command?Beta Was this translation helpful? Give feedback.
All reactions