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
0
votes
1 answer

'Optional' JWTs in a request?

First time learning about JWTs... I have a NodeJS/Express/Angular 2 application integrated with Auth0 Facebook login. I'm currently storing the user profile details in localStorage and am aware that this can be edited through the dev console. I want…
Matt Durkin
  • 267
  • 1
  • 3
  • 9
0
votes
2 answers

Decoding the token doesn't give user profile

I have been trying to solve this for several days. I followed the tutorial in Auth0's documentation. After decoding the token with express-jwt: export let headerJWTCheck = expressJwt({ secret: '*************************', audience:…
Omri Luzon
  • 3,975
  • 6
  • 20
  • 29
0
votes
1 answer

Auth0 - Rules & Groups && User Management

I have created an account with Auth0 and I am trying to get a simple login for Angular 2 to our backend API. 1. What I am trying to do is to be able to access the roles in the API to see whether the user has the correct permissions. I have enabled…
mchaffe
  • 597
  • 1
  • 4
  • 14
0
votes
1 answer

NodeJS JWT Verify Fail even token if it's the same as the sign token

Trying to develop my API on NodeJS, I get my sign token and send it back on secure api routes, but the jwt is never valid even if it's the same token I generated! What is wrong in my code ? I did my sign that way pbkdf2(queryPassword, salt, 10000,…
Vince
  • 1,279
  • 2
  • 20
  • 40
0
votes
1 answer

Express JS and JWT - Token Type not shown in decoded header

I just added token based authentication to my express JS application - Looks like the token type doesn't show in the decoded section. I'm testing using https://jwt.io/ Token I used to test - …
InquisitiveGirl
  • 667
  • 3
  • 12
  • 31
0
votes
2 answers

How to setup express-jwt with angular2 not blocking node_modules?

I am making a nodejs, angular2 app. I would like to setup a JWT authentication, I am using express-jwt, and jsonwebtoken, all my routes, and application works as expected, as long as I haven't setup the express-jwt middleware like…
GaborH
  • 689
  • 2
  • 11
  • 24
0
votes
1 answer

Missing "admin" property in express-jwt

I have a nodejs express service with express-jwt with a protected api call. app.get('/protected', jwtCheck, function(req, res) { console.log(JSON.stringify(req.user)); if (!req.user.admin) return res.send("user"); …
0
votes
0 answers

Why auth.isAuthenticated() is not working in MEAN.JS?

I have made simple signup, signin and article using MEAN.JS with jsonwebtoken. In signup page after user entering all values i am passing values to server through signup api. The server side I am creating jsonwebtoken and am passing to client…
user5503464
0
votes
2 answers

falsifying a valid JWT Token

After a successfull login, my node application returns a JWT token. The JWT is signed with user ID, expiration date and secret. Here is how I would generate a token for the user with id: 1: return jwt.sign({ _id: 1, exp:…
Lev
  • 13,856
  • 14
  • 52
  • 84
0
votes
1 answer

ExpressJS / Angular 2 JWT Tokens

I have an ExpressJS API running with ng2 (rc4) on the front end. I am currently reading up on how to protect some endpoints on my API using JWT. Currently, I can send a login request from the front end, have it picked up, checked and if valid, have…
JL Pikun
  • 15
  • 5
0
votes
2 answers

JsonWebToken User Authentication Issue

I have an app for user authentication and I ran into this issue where I have user who logged in and has the JWT (JsonWebToken) stored in the cookie. I stored the cookie after I validated the user. Next I, as the admin, remove that user from the…
Pete
  • 754
  • 2
  • 13
  • 27
0
votes
1 answer

JWT with Node & Passport: Restarting server

I am new to Node and trying to setup Node & Passport to create JWTs upon authentication. I am hoping to build a "stateless authentication mechanism" to reduce the need of going back and forward to the database. By going "stateless", if none of the…
user1107173
  • 10,334
  • 16
  • 72
  • 117
0
votes
1 answer

authentication using passport jwt

I am a newbie to token based authentication. I want to restrict the user to specific pages on my site (check his authentication) and saw that jwt is best way to implement it and followed the tutorial here:…
0
votes
1 answer

Express-jwt Throwing UnathorizedError: No Authorization Token was found in IE11 when Chrome and Firefox work

I have tracked the issue down to this call: var validateJwt = expressJwt({ secret: config.secrets.session }); using the latest version of express-jwt here is the full file ( auth.service.js from the angular-generator yeoman scafolding) /** *…
S. Hussey
  • 377
  • 1
  • 3
  • 11
0
votes
1 answer

jwt server side authentication JsonWebTokenError

I am trying to do some server side authentication. In server side login() var jwt = require('jsonwebtoken'); .... if (user.hash != hash(pass, user.salt)) { return invalid("Wrong password"); } var token = jwt.sign(user,…
Shawn
  • 5,130
  • 13
  • 66
  • 109