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.

Add ability to specify the token location in request headers

See original GitHub issue

🚀 Feature Proposal

Currently the default, non-configurable behavior for tokens sent with headers (meaning, not in cookies) is hardcoded to look for the token in the Authorization header with format Bearer {token}. It should be possible to specify a custom location and format for the token in the headers. For instance, a custom header, and a custom format not necessarily involving Bearer.

Motivation

JWT doesn’t prescribe a way to send a token to an API, so it should be possible to provide a custom location where the token is retrieved from and validated.

Example

The custom logic should override these lines of code, and could be provided as an option to the plugin via a callback which is used to extract the token from the request, for instance:

extractToken: request => token

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
thomheymanncommented, May 18, 2020

Makes sense, I’ll have a look at this today

1reaction
simonebcommented, May 18, 2020

An existing application that’s sending the token in a custom request header and sending it in this way to other existing microservices. We’re creating a new microservice based on fastify and we can’t change the way the token is sent to the services.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Authorization Bearer in Header - Custom Connector
I have unauthenticated GET methods working, but now am working on some POSTs and am running into an issue with putting "Authorization: Bearer...
Read more >
Bearer token in authorization header vs query parameter
What's the best way (when desigining a REST API) to accept a access token. 1) As an authorization header. Appears to be the...
Read more >
Add ability to specify webhook authentication token header ...
I propose adding the ability to send a token in an arbitrary header. Proposal. I want to integrate with a system that is...
Read more >
Add auth token in request header in ember-file-upload
You can pass options as second parameter of upload method. One of possible options is headers . Something like this should work:
Read more >
HTTP/1.1: Header Field Definitions
The Accept request-header field can be used to specify certain media types which are acceptable for the response. Accept headers can be used...
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