"apiKey.id required" error that occurs when using express-stormpath with node.js

I am using express-stormpath with node.js to configure the backend server. This is a snippet of my server.js code where I get the error message -

app.use(stormpath.init(app, {
 apiKeyFile: './config/.stormpath/apikey.properties',
 application: '<API_HREF>',
 secretKey: security.stormpath_secret_key
 }));

This is mistake -

$ node server.js
../webservices/node_modules/express-    
stormpath/node_modules/stormpath/lib/authc/RequestAuthenticator.js:8
throw new Error('apiKey.id is required.');

How to fix it?

+3
source share
1 answer

I assume that you are using the latest express-stormpath library , so you are probably having problems. Starting with the version 2.0.0, the library uses new configuration options.

Here is an example of the same, using the new options:

app.use(stormpath.init(app, {
 client: {
    apiKey: {
      file: './config/.stormpath/apikey.properties'
    }
 },
 application: {
   href: '<API_HREF>',
 }
}));

NOTE : No secretKey, as this is automatically generated from the API secret key Stormpath =)

, , ! < 3

+3

All Articles