Questions tagged [express-jwt]

Connect/express middleware that validates a JsonWebToken (JWT) and set the req.user with the attributes

Middleware that validates JsonWebTokens and set req.user.

This module lets you authenticate HTTP requests using JWT tokens, in your Node.js applications. JWT tokens are typically used protect API endpoints, and are often issued using OpenID Connect.

GitHub: https://github.com/auth0/express-jwt

375 questions
-1
votes
1 answer

JWT - What if the refresh token is compromised?

As far as I understand a JWT token has two parts access token (short validity) refresh token (long validity) The purpose of keeping the access token short lived is if it gets compromised, the user will not be access the resource after its…
Phantom007
  • 2,079
  • 4
  • 25
  • 37
-1
votes
1 answer

why asking for token '/company/chk_company_login' for even i have specified the path not ask for token

var { expressjwt: jwt } = require("express-jwt"); function jwts() { return jwt({ secret:"shhhh", algorithms: ["RS256", "HS256"] }).unless({ path: [ // public routes that don't require authentication …
-1
votes
1 answer

How to use tokens in front end

Im learning about JWT, but i dont know how to manage the tokens (ACCESS token and REFRESH token) in the front end for making HTTP requests. An example, when i log in in my page, i make a login request to the server that gives me an ACCESS token and…
-1
votes
1 answer

Middleware in the router taking too long to send the response

I am using the middleware function to get the user id from the jwt token and it is working completely fine but I want it to send a response when there is no jwt header in the request which it's doing. Here is the code: const jwt =…
yagyesh
  • 94
  • 7
-1
votes
1 answer

how to extract info from JWT token?

This is how my token is generated: const generate_web_token = function (user) { const token = jwt.sign( { _id: user._id, email: user.email, password: user.password, }, process.env.SECRET_TOKEN_KEY ); return…
-1
votes
1 answer

ReferenceError: req is not defined when I export my function

I am building a login app using react js node js(express, JWK) but I have a problem when I export my function I recive the error ReferenceError: req is not defined but how I defined req??? This user.router.js: const { verifyToken } =…
Pedrohhcunha
  • 41
  • 1
  • 6
-1
votes
1 answer

Which one? Node-jws or node-jsonwebtoken?

There are two packages for JWT application in Node.js .But uses same method for signing and verifying . Which one is for production purpose ?
-1
votes
1 answer

Where I can store JWT token in React js for authenticate the various routes on back end of app?

I am using the JWT token for authentication and authorization.After Login I want to store the value of token in frontend (React js) so that we can send the token on server for validating the different routes in node js according to the different api…
Sharad kumar
  • 187
  • 2
  • 14
-1
votes
1 answer

I uploaded my frontend and backend app to Heroku but I cannot use jwt()

I uploaded my nodejs backend and angular frontend project to heroku and in order to get it working, I had to remove the app.use(jwt()); in order for the deployment to work. The issue is I want jwt to be used in the app. Once removed, I get the…
zee123
  • 73
  • 1
  • 9
-1
votes
1 answer

Node js JWT token not generated with RS256 algorithm

I used JWT to protect my node.js REST api calls. I used below code to generate the token: jwt.sign({ foo: 'bar' }, private_key, { algorithm: 'RS256'}, (err, token) => { res.json({ token }); But I don't get any token with when I…
Jogi Prasad Pakki
  • 2,013
  • 2
  • 11
  • 21
-1
votes
1 answer

With express-jwt, can I return a different status code other than 401?

I'm using express-jwt. I want to send a different status code back when it fails. I actually have 2 different express-jwt middlewares set up, one that requires credentials and the other that decodes the token optionally if it's there. With the…
kane
  • 5,465
  • 6
  • 44
  • 72
-1
votes
1 answer

How to secure JWT tokens

I am using JWT tokens to authorize requests to my API from an angular website and i am saving the token in local storage but the problem is it is prone to attacks because attackers can just easily get the token from the local storage and easily get…
Sagaya Abdul
  • 151
  • 1
  • 11
-2
votes
1 answer

I have NodeJs-Flutter authentication problem

I have android app (Flutter) and backend (NodeJs) I am using JWT authentication method there is no sign up , I previously added users to DB so they can logged in with their personal id and combination of their personal id and another personal…
-4
votes
2 answers

import error when trying to import express-jwt

Here is the error I'm getting. Please help. C:\Users\Val\Desktop\merncamp\server\middleware\index.js:1 import expressJwt from "express-jwt"; SyntaxError: The requested…
1 2 3
24
25