Questions tagged [fastify-jwt]

6 questions
2
votes
1 answer

NestJS Fastify JWKS Validation

I am using the Fastify Adapter in my NestJS application and would like to add some logic to do JWKS validation, similar to the passport example on the Auth0 website. // src/authz/jwt.strategy.ts import { Injectable } from '@nestjs/common'; import…
mh377
  • 1,656
  • 5
  • 22
  • 41
0
votes
1 answer

Nodejs Fastify call function in handler from a cron job

We have a web application using Fastify. There is a function in a handler that we need to call it from a cron job inside the same application. index.js async function registerRoutes(fastify) { fastify .post( '/statements/generate', …
Jose Antonio
  • 578
  • 1
  • 8
  • 34
0
votes
1 answer

Fastify CLI decorators undefined

I'm using fastify-cli for building my server application. For testing I want to generate some test JWTs. Therefore I want to use the sign method of the fastify-jwt plugin. If I run the application with fastify start -l info ./src/app.js everything…
Manu
  • 922
  • 6
  • 16
0
votes
1 answer

Create an auth.js middleware

I have created an auth.js middleware with fastify and prisma but I don't know how to insert it in my route. Here are some examples const jwt = require("jsonwebtoken"); require("dotenv").config(); module.exports = (request, reply) => { try { …
0
votes
0 answers

Creating JWT for testing API protected with Auth0

I am trying to cover my API, protected by Auth0, with unit tests. Wrote the below: 'use strict'; const createJWKSMock = require('mock-jwks').default; const startAuthServer = jwksServer => { const jwks = createJWKSMock(jwksServer); …
Igor Shmukler
  • 1,742
  • 3
  • 15
  • 48
0
votes
1 answer

fastify-jwt sign token with user ID payload

I'm making a simple sign-in function, that will return a token with the user's ID. I've registered the fastify-jwt on the fastify instance with the key and added user id in the call to the sign function. Code auth.js import Fastify from…
Evan
  • 2,327
  • 5
  • 31
  • 63