Error: No default account store is mapped to the specified application
Error: No default account store is mapped to the specified application
我遵循了此处的文档:https://github.com/stormpath/express-stormpath
错误:没有默认帐户存储映射到指定的应用程序
当我尝试 运行 我的应用程序时,控制台出现上述错误。这很可能是我的代码有问题,还是我应该转到 Stormpath 站点上的管理页面?
我使用 windows 命令 setx 来设置环境变量,如果我的 app.js 文件中有 api 密钥和秘密,我不确定是否需要这样做。对于这个问题,我删除了 XXXXXXXX 的敏感信息。
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.')
});
在此先感谢您的帮助。
是的!此错误很可能是由于管理控制台中的 Stormpath 应用程序配置所致。
每个应用程序都需要一个 "directory" 来存储您的帐户,但您似乎没有。
尝试登录 Stormpath 并添加 "directory" 以将您的帐户存储在管理控制台中。如果这样做,请尝试确保选中 "default account location"。
这是我的样子。希望这对您有所帮助!
(来源:我在 Stormpath 工作)
我遵循了此处的文档:https://github.com/stormpath/express-stormpath
错误:没有默认帐户存储映射到指定的应用程序
当我尝试 运行 我的应用程序时,控制台出现上述错误。这很可能是我的代码有问题,还是我应该转到 Stormpath 站点上的管理页面?
我使用 windows 命令 setx 来设置环境变量,如果我的 app.js 文件中有 api 密钥和秘密,我不确定是否需要这样做。对于这个问题,我删除了 XXXXXXXX 的敏感信息。
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.')
});
在此先感谢您的帮助。
是的!此错误很可能是由于管理控制台中的 Stormpath 应用程序配置所致。
每个应用程序都需要一个 "directory" 来存储您的帐户,但您似乎没有。
尝试登录 Stormpath 并添加 "directory" 以将您的帐户存储在管理控制台中。如果这样做,请尝试确保选中 "default account location"。
这是我的样子。希望这对您有所帮助!
(来源:我在 Stormpath 工作)