Giter VIP home page Giter VIP logo

Comments (14)

sergeyampo avatar sergeyampo commented on May 3, 2024 6

Russian needs too :)

from jwt.

muuran avatar muuran commented on May 3, 2024 5

I found temporary workaround for AzureAD.

import { Module } from '@nestjs/common';
import { JwtModule } from '@nestjs/jwt';
import { JwksClient } from 'jwks-rsa';
import * as jwt from 'jsonwebtoken';

@Module({
  imports: [
    JwtModule.registerAsync({
      async useFactory() {
        const client = new JwksClient({
          cache: true,
          rateLimit: true,
          jwksRequestsPerMinute: 5,
          jwksUri: `https://login.microsoftonline.com/common/discovery/keys`,
        });
        const keys = await client.getSigningKeys();

        return {
          secretOrKeyProvider(requestType, token: string) {
            const decoded = jwt.decode(token, { complete: true });
            return keys
              .find((key) => key.kid === decoded.header.kid)
              .getPublicKey();
          },
          verifyOptions: {
            audience: '(client id)',
            issuer:
              'https://login.microsoftonline.com/(tenant id}/v2.0',
            algorithms: ['RS256'],
          },
        };
      },
    }),
  ],
})
export class AuthModule {}

from jwt.

katesroad avatar katesroad commented on May 3, 2024 4

Hey, any updates with this issue?

from jwt.

vtrphan avatar vtrphan commented on May 3, 2024 2

i need this feature too. I think with the package passport-jwt we can use this feature already

from jwt.

foolishell avatar foolishell commented on May 3, 2024 1

Hi, from Japan.
I'm also looking forward to this feature!

from jwt.

kamilmysliwiec avatar kamilmysliwiec commented on May 3, 2024

Would you like to create a PR for this issue?

from jwt.

rafaelcorreiapoli avatar rafaelcorreiapoli commented on May 3, 2024

Sure! If you think it makes sense I can work on a PR :)

from jwt.

kamilmysliwiec avatar kamilmysliwiec commented on May 3, 2024

That would be great!

from jwt.

iamsuneeth avatar iamsuneeth commented on May 3, 2024

Hi @rafaelcorreiapoli , any update on the PR for this one?

from jwt.

rafaelcorreiapoli avatar rafaelcorreiapoli commented on May 3, 2024

@iamsuneeth Sorry I could not advance with the PR.

from jwt.

guru2228 avatar guru2228 commented on May 3, 2024

Hi, any updates on supporting JWKS URI as secretOrKeyProvider

from jwt.

xzyfer avatar xzyfer commented on May 3, 2024

Please 🙏

from jwt.

xzyfer avatar xzyfer commented on May 3, 2024

I've updated #469 in #1486 to resolve conflicts and typos as the proposed workaround only fetches keys on boot which isn't suitable to handle key rotations.

from jwt.

kamilmysliwiec avatar kamilmysliwiec commented on May 3, 2024

Let's track this here #1486

from jwt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.