Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jwks-rsa 1.6.0 package breaking code #103

Closed
firojasha opened this issue Jul 12, 2019 · 9 comments · Fixed by #120
Closed

jwks-rsa 1.6.0 package breaking code #103

firojasha opened this issue Jul 12, 2019 · 9 comments · Fixed by #120

Comments

@firojasha
Copy link

Hi,
[email protected] is breaking our code with the below error, when we go back to [email protected] we are not seeing the below mentioned issue and application working perfectly,

Please check what is causing to break when install [email protected] package.

src/eso/RebarESOUtils.ts:119:46 - error TS2339: Property 'publicKey' does not exist on type 'SigningKey'.
Property 'publicKey' does not exist on type 'RsaSigningKey'.
119 let signingKey = key.publicKey || key.rsaPublicKey; ~~~~~~~~~
src/eso/RebarESOUtils.ts:119:63 - error TS2339: Property 'rsaPublicKey' does not exist on type 'SigningKey'.
Property 'rsaPublicKey' does not exist on type 'CertSigningKey'.
119 let signingKey = key.publicKey || key.rsaPublicKey;

Regards,
Firoj Shaik

@firojasha firojasha changed the title jwks-rsa 1.6.0 package breaking code. jwks-rsa 1.6.0 package breaking code Jul 12, 2019
@Doacola
Copy link

Doacola commented Jul 12, 2019

Hi @firojasha ,

Encountered the same issue today and after 30 minutes of searching managed to track it down to this commit / line:
74f6fe3#diff-b52768974e6bc0faccb7d4b75b162c99R58

Sadly there was no mention of this breaking change anywhere nor was there documentation update.

Working solution for now is:

const getKey = (header, callback) => {
      client.getSigningKey(header.kid, (err, key: jwksClient.SigningKey) => {
        const signingKey =
          (key as jwksClient.CertSigningKey).publicKey ||
          (key as jwksClient.RsaSigningKey).rsaPublicKey
        callback(null, signingKey)
      })
}

@lemiesz
Copy link

lemiesz commented Jul 18, 2019

+1 having the same error. Downgrading version for now

@firojasha
Copy link
Author

Is there any update on this, please?

@ChristopherNeuwirth
Copy link

upgraded today from 1.5.0 and facing the same issue.

@sgil-carecloud
Copy link

experiencing the same issue

@jimmyjames
Copy link
Contributor

For those encountering this issue, we sincerely apologize for the unexpected breaking change. We are evaluating the best path forward to address this; in the meantime please remain on version 1.5 if you don't need to support private certificates and/or additional agent configurations that was added in v6, or consider the suggested workarounds above.

@lbalmaceda
Copy link
Contributor

Hi all. Considering the time passed since the unintended breaking change, we've released version 1.6.2 which includes a quick way to obtain the Public Key value, and resolve any TS definitions conflicts that were introduced with 1.6.0.

Now, instead of type-checking the value and accessing either key.publicKey or key.rsaPublicKey properties, you can directly invoke the key.getPublicKey() function:

const getKey = (header, callback) => {
      client.getSigningKey(header.kid, (err, key: jwksClient.SigningKey) => {
        const signingKey = key.getPublicKey()
        callback(null, signingKey)
      })
}

We apologize for any inconvenience that this has caused.

@Guriqbal-Singh-Alida
Copy link

Guriqbal-Singh-Alida commented Jun 8, 2021

@lbalmaceda please update readme example at https://github.com/auth0/node-jsonwebtoken#jwtverifytoken-secretorpublickey-options-callback with above too if its the suggested way now

@ankushknr19
Copy link

function getKey(header: any, callback: any) {
      client.getSigningKey( header.kid, function (_err, key: jwksClient.SigningKey | undefined) {
            const signingKey =
                             (key as jwksClient.CertSigningKey).publicKey || 
                             (key as jwksClient.RsaSigningKey).rsaPublicKey
	    callback(null, signingKey)
      })
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants