'm using auth0 for login after successful login user gets access token, in some backend functions we need to verify token and if successful grant access to function otherwise reject it. I copied public key from auth0 dashboard->advanced settings->certificates
since library jwks-rsa isn’t working at all in worker. Here is my code:
const publicKey =`
MIIDIzCC.....faMQkU`
const options = {
audience: ['clientID'],
issuer: [
'https://MYDOMAIN/',
],
algorithms: ['RS256'],
}
const token =
'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtp.....Nhe08A'
jwt.verify(token, publicKey, options, (err, decoded) => {
if (err) {
console.log('jwt validation error', err)
} else {
console.log('verified token', decoded)
}
})
I only have error which says error
Anyone idea what I’m doing wrong here?