title: How to get the value of decoded JSON Web Token (JWT)
body: <p>I'm using the Mailgun node machine-pack to send an email with a url that has a JWT created using machinepack-jwt in it. When the user clicks "confirm" in the generated email it hits my Sails controller method where I want to decode the JWT. </p>
  
  <p>I keep getting an object with properties that have empty strings as their value. </p>
  
  <p>For reference: 
  I'm using <a href="http://node-machine.org/machinepack-jwt" rel="nofollow">node-machine machinepack-jwt</a> to do the encoding and decoding. I tried to tag the question as such but this tag isn't in the available tags and I don't have the required 1500 rep points</p>
  
  <p>My sails controller:</p>
  
  <pre><code> module.exports = {
     //Encode method
     signup: function (req, res){
       if (!req.param('serviceManager')) {
         res.badRequest('Missing required parameter!');
       } else {
         var Mailgun = require('machinepack-mailgun');
         var JWT = require('machinepack-jwt');
         var newUser = req.param('serviceManager');
         JWT.encode({
           secret: 'my_secret',
           algorithm: 'my_algo',
           expires: 2880, //in minutes(two days)
           payload: newUser.email + ':' + newUser.password
         }).exec({
           error: function (err){
             console.log(err);
           },
           success : function (authToken){
             Mailgun.sendHtmlEmail({//my Mailgun send with template that has authToken in it});
  
      //Decode method
      confirm_email: function (req, res){
        if (!req.params[0]) {
          res.badRequest('Missing required parameter!');
       } else {
         var JWT = require('machinepack-jwt');
         var authToken = req.params[0];
         console.log(authToken);
         JWT.decode({
           secret: 'my_secret',
           token: authToken,
           algorithm: 'my_algo'
         }).exec({
           error: function (err) {
             res.send(err);
           },
           success: function (decodedToken) {
             res.view('emailconfirmed');
             console.log(decodedToken);// returns { id: '', email: '', role: '', sessionId: '' }
           }
         });
       }
     }
  </code></pre>
  
  <p>What I'm expecting is the users email and password which I've encoded in the sent JWT. </p>