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.

Auth Error, Error: Bad Request

See original GitHub issue

Q&A (please complete the following information)

  • OS: macOs
  • Browser: chrome
  • Version: 69
  • Method of installation: npm
  • Swagger-UI version: ? swagger-ui-express 3.0.1 comes with a static directory with swagger ui.
  • Swagger/OpenAPI version: 2

Content & configuration

Example Swagger/OpenAPI definition:

securityDefinitions:
  oauth:
    type: oauth2
    tokenUrl: /oauth/token
    flow: application
security:
  - oauth: []

Swagger-UI configuration options:

// Configure Swagger Docs
let swaggerDocument = yaml.safeLoad(fs.readFileSync('./api/swagger/swagger.yaml', 'utf8'));
app.use('/docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument));

Describe the bug you’re encountering

I am no longer able to authentication through live docs. Debugging the POST request to /oauth/token via chrome devtools shows that the client_id and client_secret are not being send. grant_type is and is the correct value “client_credentials”.

To reproduce…

Steps to reproduce the behavior:

  1. Go to /docs (my configured router for swagger ui via express)
  2. Click on ‘Authenticate’
  3. Enter ‘client_id’
  4. Enter ‘client_secret’
  5. Click modal ‘Authenticate’ button, which submits the form
  6. See error

Expected behavior

Should authenticate

Screenshots

screen shot 2018-09-21 at 11 50 36 am

screen shot 2018-09-27 at 10 01 49 am

Additional context or thoughts

I know that the yaml config for OAuth2 is being consumed because its giving me the OAuth2 authentication form. The break down is in sending the entered credentials.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:15 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
shockeycommented, Dec 5, 2018

@pacey, can you email me about this? I have a branch here, I’d like for you to take a look and tell me if it addresses your use case. kyle.shockey@smartbear.com.

1reaction
bozzltroncommented, Oct 22, 2018

Thanks for the clarification here. For future readers the basic authorization header is constructed by base 64 encoded a string that contains client_id and client_secret and is delimited by “:”.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: Bad Request when trying to authenticate user
If the external API request returns an Error: Bad Request (or any other error), the application would get that error directly as you...
Read more >
Bad request 400 when trying to retrieve the Access Token
Well, that information is actually interesting -- it shows that your error is coming from the reverse proxy (nginx) that sits in front...
Read more >
400 Bad Request - HTTP - MDN Web Docs
The HyperText Transfer Protocol (HTTP) 400 Bad Request response status code indicates that the server cannot or will not process the request ......
Read more >
OAuth HTTP error response reference | Apigee Edge
HTTP/1.1 400 Bad Request {"ErrorCode" : "invalid_request", "Error" :"Redirection URI is required"} ... "Error" :"Invalid Authorization Code"} ...
Read more >
400 Bad Request when redirecting to the /authorize endpoint ...
Resolution · OIDC application may be set to INACTIVE in Okta. Make sure the application you are testing with is set to ACTIVE...
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