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.

Pass token on query string / allow passing custom getToken function

See original GitHub issue

It would be nice to allow passing the token on the query string (?token=....) instead of having to passing it as a request header. express-jwt permits this by allowing you to pass a custom getToken function like so:

  secret: 'hello world !',
  credentialsRequired: false,
  getToken: function fromHeaderOrQuerystring (req) {
    if (req.headers.authorization && req.headers.authorization.split(' ')[0] === 'Bearer') {
        return req.headers.authorization.split(' ')[1];
    } else if (req.query && req.query.token) {
      return req.query.token;
    return null;

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:19 (8 by maintainers)

github_iconTop GitHub Comments

stiangcommented, Apr 21, 2016

Thanks for the reminder, @nfantone 😃 I‘ve merged it and published 1.2.0.

Thanks for the contribution, @danwkennedy!

danwkennedycommented, Apr 22, 2016

I’m gonna leave it. You could do something similar inside of the getToken function (i.e. check this or check that)

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I use a token from a request for other requests after ...
Token = GetToken(Request);//Made into a separate function in the inherited class _backgroundTaskQueue.StartTask(request); return Ok(new ...
Read more >
Deprecating usage of token as a query string parameter in ...
On February 24, 2021 we will stop allowing newly created apps to send token query string parameters. Need any help? Let us know!...
Read more >
Authentication and authorization in ASP.NET Core SignalR
When using WebSockets and Server-Sent Events, the token is transmitted as a query string parameter. Built-in JWT authentication. On the server, ...
Read more >
Access Tokens - Auth0
The passed token informs the API that the bearer of the token has been authorized to access the API and perform specific actions...
Read more >
JSON Web Token Tutorial using AngularJS & Laravel - Toptal
In order to do this, the request Authorization header or query string needs to provide ... This is passed to the controller via...
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 Post

No results found

github_iconTop Related Hashnode Post

No results found