title: node.js apn Failed to generate token
body: <p>As title, i use node-apn package to send push notification to iOS devices.</p>
  
  <p>In my local machine (MacOS), i can send notification to device successfully, but when i deploy my codes to a CentOS server, i can't apnProvider object.</p>
  
  <p>My Codes is:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var apn = require('apn')
  var path = require('path')
  
  let options = {
    token: {
      key: path.resolve('/path/to/f8/keyfile'),
      keyId: 'myKeyId',
      teamId: "myTeamID"
    },
    production: false
  };
  
  var apnProvider = new apn.Provider(options);</code></pre>
  </div>
  </div>
  </p>
  
  <p>I got this error, (i tried google about it but can't find a solution):</p>
  
  <p>/root/buzzship/node.js/node_modules/apn/lib/credentials/token/prepare.js:45
        throw new VError(err, "Failed to generate token");
        ^
  VError: Failed to generate token: error:0906D064:PEM routines:PEM_read_bio:bad base64 decode
      at prepareToken (/root/buzzship/node.js/node_modules/apn/lib/credentials/token/prepare.js:45:13)
      at config (/root/buzzship/node.js/node_modules/apn/lib/config.js:42:31)
      at new Client (/root/buzzship/node.js/node_modules/apn/lib/client.js:11:19)
      at EventEmitter.Provider (/root/buzzship/node.js/node_modules/apn/lib/provider.js:12:19)
      at Object. (/root/buzzship/node.js/index-api.js:128:19)
      at Module._compile (module.js:570:32)
      at Object.Module._extensions..js (module.js:579:10)
      at Module.load (module.js:487:32)
      at tryModuleLoad (module.js:446:12)
      at Function.Module._load (module.js:438:3)
      at Module.runMain (module.js:604:10)
      at run (bootstrap_node.js:393:7)
      at startup (bootstrap_node.js:150:9)
      at bootstrap_node.js:508:3</p>
  
  <p>Please tell me what i am wrong at, thank you.</p>