question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Authorization header not sent using "try it out", with SecuritySchemes Basic

See original GitHub issue

Q&A (please complete the following information)

  • OS: Ubuntu 18.10
  • Browser: Firefox 60.5.1
  • swagger-ui-3.24.0
  • Swagger/OpenAPI version: OpenAPI 3.0.1 Using Swagger-ui through org.webjars.swagger-ui:3.24.0 fork that is used by gradle-swagger-generator-plugin:2.15.1

Content & configuration

openapi: 3.0.1
info:
  title: xxx
  description: yyy
  contact:
    email: a@b.com.br
  version: "1.0"
externalDocs:
  description: Something
  url: https://someurl.com.br
servers:
- url: http://dsv:7422/
  description: DSV
  variables: {}
- url: http://qld:7422/
  description: QLD
  variables: {}
- url: http://hmg:7422/
  description: HMG
  variables: {}
tags:
- name: Bloco
paths:
  /blocks/query:
    get:
      tags:
      - Bloco
      summary: Something
      description: SomeDescription
      operationId: getBlocks
      parameters:
      - name: anpBlockType
        in: query
        description: queryparamDescription
        schema:
          type: string
      responses:
        "200":
          description: Sucess!
      security:
      - myLdapAuth: []
components:
  securitySchemes:
    myLdapAuth:
      type: http
      scheme: basic

Screenshots

How can we help?

The swagger page shows this curl command for the operation “query”: curl -X GET “http://dsv:7422/blocks/query?anpBlockType=prod” -H “accept: application/json” -H “Authorization: Basic <XxxXX>”

Bu when it sends the request it sends with no Authorization header:

Host: dsv:7422 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Access-Control-Request-Method: GET Access-Control-Request-Headers: authorization Origin: http://dsv:7422 Connection: keep-alive

I’m generating the openapi.yaml with java annotations.

Do you know what is wrong?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
taciosdcommented, Nov 26, 2019

@webron @hkosova Thank you for the fast feedback. You are right, my server isn’t dealing with CORS requests in the proper way. I made some tests here and that is the issue. I will close this issue. Thank you again!

0reactions
webroncommented, Nov 26, 2019

@taciosd take a look at @hkosova’s comment. When I try your API definition, I don’t encounter the same issue…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Basic Authentication
Basic authentication is a simple authentication scheme built into the HTTP protocol. The client sends HTTP requests with the Authorization header that ...
Read more >
Authorization header not visible in API request fo...
This problem is only noticed in test environment. Prod environment works fine. I used the following method in swagger spec for Authorization ......
Read more >
java - Authorization Header not getting displayed in CURL ...
I have searched for an answer on the same. We can not set Authorization as a header with springdoc open api . if...
Read more >
Authorizing requests | Postman Learning Center
If a custom prefix is needed, use an API Key with a key of Authorization. Basic auth. Basic authentication involves sending a verified...
Read more >
Security — Connexion 3.0.dev0 documentation
You can find a minimal Basic Auth example application in Connexion's “examples” ... do not by default pass authentication headers to WSGI applications....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found