I followed the documentation here: https://github.com/stormpath/express-stormpath
Error: No default account store is mapped to the specified application
I get the above error in the console when I try to run my app. Is this more than likely a problem with my code, or should I go to my admin page on the Stormpath site?
I used windows command setx to set the environment variables, not sure if I need to do that if I have the api key and secret in my app.js file. I removed sensitive info with XXXXXXXX for this question.
var express = require('express');
var app = express();
//Stormpath
var stormpath = require('express-stormpath');
//Init Stormpath
app.use(stormpath.init(app, {
apiKey: {id:'XXXXXXXXXX', secret: 'XXXXXXXXXX'},
secretKey: 'random_string_of_words_go_here',
application: 'https://api.stormpath.com/v1/accounts/XXXXXXXXX'
}));
//home:
app.get('/', function(req, res){
res.render('home');
console.log(req.session);
});
app.get('/create-quiz', stormpath.loginRequired, function(req, res){
res.render('createQuiz');
});
//404 page:
app.use(function(req, res, next){
res.status(404);
res.render('404');
});
//500 page:
app.use(function(err, req, res, next){
console.error(err.stack);
res.status(500);
res.render('500');
});
app.on('stormpath.ready', function () {
console.log('Stormpath ready...')
});
app.listen(app.get('port'), function(){
console.log('Express started on http://localhost: ' + app.get('port') + '; Press ctrl-C to terminate.')
});
Thanks in advance for any help.
Yep! This error is most likely because of your Stormpath application configuration in the admin console.
Every application needs a "directory" to store your accounts, and it seems like you might not have one.
Try signing into Stormpath and adding a "directory" to store your accounts in the admin console. If you do, try making sure you check "default account location".
Here's what mine looks like. Hope this helps!
(Source: I work at Stormpath)