I have been following the Heroku Stormpath docs to setup a simple Express app. The code from my server.js file is shown below:
'use strict';
var express = require('express');
var pg = require('pg');
var stormpath = require('express-stormpath');
var app = express();
app.use(express.static('public'));
app.use(stormpath.init(app, {
apiKeyFile: '/.stormpath/apiKey.properties',
apiKeyId: process.env.STORMPATH_API_KEY_ID,
apiKeySecret: process.env.STORMPATH_API_KEY_SECRET,
secretKey: process.env.STORMPATH_SECRET_KEY,
application: process.env.STORMPATH_URL,
}));
app.set('port', (process.env.PORT || 5000));
app.listen(app.get('port'), function(){
console.log('Node app is running on port', app.get('port'));
});
Forgive me for being a newbie to Stormpath. I've looked through the Express-Stormpath docs as well, but I continue to receive the following error when running the app locally:
Node app is running on port 5000
events.js:141
throw er; // Unhandled 'error' event
^
Error: API key ID and secret is required.
I have provisioned the Stormpath addon via Heroku, and when running heroku config
in the terminal I see that all of the variables passed into stormpath.init
are available. Can someone enlighten me as to what I am doing wrong?
if you are running your server app locally, I can guess that you didn't create the environment variables so try this:
or you can set the storm values whenever they are empty as in your case:
in either case provide your real stormpath values from your addon at heroku.