Questions tagged [jwt-simple]

7 questions
7
votes
2 answers

does JWT containing userID need verification from the database?

I sign a JWT (JSON Web Token) with userID and iat (issues at) like so jwt.encode({sub: user.id, iat: timestamp}, jwtSecret); When I receive a JWT from the client, I decode it to extract the userID. Do I need to validate the userID by checking its…
quantdaddy
  • 1,375
  • 4
  • 19
  • 29
3
votes
1 answer

Axum: pass parameters to handlers

new to rust here. I am trying to build a simple server that provides and decodes JWT tokens and I am missing a big part. Here is the code: pub struct Server { pub host: String, pub port: String, pub public_key: String, pub…
Francesco
  • 1,742
  • 5
  • 44
  • 78
3
votes
2 answers

How to fix parser() is deprecated and 'setSigningKey(java.security.Key)' is deprecated?

this is the error I am facing in here public boolean validateToken(String jwt){ Jwts.parser().setSigningKey(key).parseClaimsJws(jwt); return true; }
Md Esadulhaq
  • 51
  • 1
  • 2
3
votes
1 answer

Passport JWT authentication extract token

I am using express & jwt-simple to handle login/register & authenticated requests as a middleware api. I'm trying to create a .well-known endpoint so other api's can authenticate request based on token send in. Here's my strategy: module.exports =…
Joelgullander
  • 1,624
  • 2
  • 20
  • 46
1
vote
1 answer

Passport: Error: passport.initialize() middleware not in use;

I'm have an express server with MongoDB and Mongoose, and using passport to authenticate with JWT, but getting an error as in the title. I'm following the passport-jwt documentation, but am still getting the error. What am I doing wrong? Here is the…
bigmugcup
  • 1,321
  • 4
  • 15
  • 26
0
votes
1 answer

Stubbing JWT-Simple functions with Sinon

I would like to be able to stub the encode function inside of the jwt-simple library. Something like this: import { encode } from 'jwt-simple'; sinon.stub(encode).returns('your encoded string'); Is this possible? I have been trying to find…
ez33
  • 531
  • 4
  • 4
0
votes
2 answers

Angular 4 Cannot find name Error

I'm using the jwt simple library: https://www.npmjs.com/package/jwt-simple In one of my Typescript, I have the following: const jwt = require('jwt-simple'); const payload = { user: 'joesan' }; const secret = 'testtest'; Now when I run this…
joesan
  • 13,963
  • 27
  • 95
  • 232