Friday 15 June 2012

node.js - Stormpath Integration, ExpressJS 'Stormpath 401Authentication with Vaild API Key is required' -


There is a strange error in trying to work through storm in my ExpressGS app. I have installed a storm application and My Generated API key has been received. console.log shows my environment id and secret key in my terminal so that they are running in my app. apiKeyFile: Path is working fine to get my key. I can not understand why I am getting a resource error: HTTP 401, StormTap 401 (http: // www. .stormpath.com / docs / quickstart / connect): Validation is required with valid API key.

I am new to storm and express so that any advice will be highly appreciated. Thanks!

  // application.js in console.log All other middleware (process.env ['STORMPATH_API_KEY_SECRET']) console.log (process.env ['STORMPATH_API_KEY_ID']) App.use (Stormpath.init (app, {apiKeyFile: 'My API key is working for FE', application: 'https://api.stormpath.com/v1/applications/' + process.env ['STORMPATH_API_KEY_ID'] , SecretKey: process.env ['STORMPATH_API_KEY_SECRET']}));  

I am the author of the library, you have two problems here:

  1. You only need to set your API key in the same way (by the Environment variable, by the API key file, or by manual entry in the code) you are doing it in two ways (APK file and environment variable ).

  2. Your API keys are invalid.

What's happening is that the library is pulling in your API key before the environment variable, and these keys are currently invalid.

To test it further, try doing this:

  App. Use (stormpath.init (app, {APK file: '/ path / to / API properties'});  

and delete any environment variables previously set.

If you are still getting errors, then you still have the wrong API key (maybe you delete what you are using) - then go to the Stormpath Dashboard and add a new API Make a key pair.


No comments:

Post a Comment