Invalid signature attempting to verify token Node.JS

There is a neat node package out there that handles stuff like that for you -> https://www.npmjs.com/package/twitchext-helper

Quick Example:

const custom_options = {
    "jwt_secret": {
        "encoded": true, //default is to assume base64, will decode for you
        "expires": 1503343947, //for signing jwts
        "enabled": true, //enable below options
        "method":"path",//path to file that holds jwt_secret
        "location": "../../config/variables" //file with jwt_secret variable
      },
    "client_id": "some client id",
    "client_secret": "some client secret"
}


const twitchext = require('twitchext-helper')(custom_options);

//Custom configuration
twitchext.verify(signedToken, function(err, decoded){
    if(err){throw err;}
    console.log(decoded);
});
 
//Default configuration
twitchext.verify(signedToken, "some secret here", function(err, decoded){
    if(err){throw err;}
    console.log(decoded);
});

You can set that jwt_secret encoded option to true and it will always decode for you when using twitch-helper functions through out the rest of your code. Package is still in early stages but is working good so far