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

See original GitHub issue

WDYT in having something like:

openapi3.js around line 136

    if ('bearerAuth' in data.api.components.securitySchemes) {
        var authorization = {};
        authorization.name = 'Authorization';
        authorization.type = 'string';
        authorization.in = 'header';
        authorization.exampleValues = {};
        authorization.exampleValues.json = "'Bearer {access_token}'";
        authorization.exampleValues.object = ['Bearer {access_token}'];
        data.allHeaders.push(authorization);
    }

That way the code examples would be more complete since the generated header would include the required authorization header.

e.g

curl -X POST https://x.com/activate \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {access_token}'

instead of

curl -X POST https://x.com/activate \
  -H 'Accept: application/json'

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
MikeRalphsoncommented, Mar 27, 2018

@trev @alexanderkjeldaas @luigi-riefolo I’ve added code to generate an Authorization header where the securityScheme is either http with the bearer scheme, or auth2 or openIdConnect.

If you can test from the GitHub repository, that would be great, otherwise these changes will be published as part of Widdershins v3.1.0

1reaction
MikeRalphsoncommented, Dec 15, 2017

I like it! Do you want to work up a PR based on the code above? I think you’d need to detect the type: http and scheme: bearer of the securityScheme referenced by the operation or the default Security Requirement Object.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Authorization - HTTP - MDN Web Docs - Mozilla
The HTTP Authorization request header can be used to provide credentials that authenticate a user agent with a server, allowing access to a ......
Read more >
Basic access authentication - Wikipedia
In basic HTTP authentication, a request contains a header field in the form of Authorization: Basic <credentials> , where credentials is the Base64...
Read more >
Http authorization header entity definition - Microsoft Learn
An authorization header used in HTTP request. Pattern. Various authentication header formats for example: authorization: basic ********
Read more >
HTTP headers | Authorization - GeeksforGeeks
The HTTP headers Authorization header is a request type header that used to contains the credentials information to authenticate a user ...
Read more >
Bearer Authentication - Swagger
The client must send this token in the Authorization header when making requests to protected resources: Authorization: Bearer <token>.
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