Always got this error
{ name: 'JsonWebTokenError',
message: 'jwt audience invalid. expected: undefined' }
I've correctly specified
jwt.verify(token,secred,{audience : 'https://asksja.com'},function(err,decoded) {
if(err){
console.log(err);
return res.status(401).json({status:401,msg:"Invalid audience"});
}
console.log("Audience Pass");
next();
});
You should try check your index.js line 103
console.log(payload);
the output still
{ audience: ff
issuer:ff
subject: fff
email: ggg
iat: 1423041815 }
and you check below it like
payload.aud , this would be 'undefine'
Also , I have this token generated from iOS library
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJlbWFpbCI6Im5hZHlhQHlhaG9vLmNvbSIsImF1ZGllbmNlIjoiaHR0cHM6XC9cL2FwaS50dWluZ2xlLmNvbSIsInN1YmplY3QiOiI1MTM3ODI5MjIxNDg3NDg0ODI0NDAxIiwiaXNzdWVyIjoibXlQYWNrYWdlLnR1aW5nbGUuY29tIiwiaWF0IjoxNDIwOTYwOTI0fQ==.55G6LfE9Zkse0Z7bppTK9IhhTe8DMSq0XlJrtajk4DhOSsHVBXDtwuXEeLc7t0Sv5BosV5f2NDePrSjjapBfkA==
its valid when check it on jwt.io
but invalid signature when verify
Thanks
@jfromaniello
Always got this error
{ name: 'JsonWebTokenError',
message: 'jwt audience invalid. expected: undefined' }
I've correctly specified
You should try check your index.js line 103
console.log(payload);
the output still
{ audience: ff
issuer:ff
subject: fff
email: ggg
iat: 1423041815 }
and you check below it like
payload.aud , this would be 'undefine'
Also , I have this token generated from iOS library
its valid when check it on jwt.io
but invalid signature when verify
Thanks
@jfromaniello