I’ve got code like so:
async function isTokenValid(token) {
if (token) {
const bearerToken = token.split(' ');
const result = new Promise((resolve, reject) => {
console.log('hi there');
jwt.verify(
bearerToken[1],
getKey,
{
audience: process.env.API_IDENTIFIER,
issuer: `https://${process.env.AUTH0_DOMAIN}/`,
algorithms: ['RS256'],
},
(error, decoded) => {
console.log('hi there 3');
if (error) {
console.log('hi there 2');
resolve({ error });
}
if (decoded) {
resolve({ decoded });
}
},
);
});
return result;
}
return { error: 'No token provided' };
}
When I pass in a token from auth0 it validates right away. If I pass in some made up thing it fails immediately, if I give it a valid token from another system it hangs.