gpt4 book ai didi

stormpath - 将 express-stormpath 与 node.js 一起使用时抛出“需要 apiKey.id”错误

转载 作者:行者123 更新时间:2023-12-01 13:49:10 25 4
gpt4 key购买 nike

我正在使用带有 node.js 的 express-stormpath 来设置后端服务器。这是我的 server.js 代码片段,我在其中抛出错误 -

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

这是错误-

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

我该如何解决这个问题?

最佳答案

我假设您使用的是最新版本的 express-stormpath库,这就是您可能遇到问题的原因。从 2.0.0 版本开始,该库使用了新的配置选项。

这是使用新选项的相同示例:

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

注意:不需要 secretKey,因为它是根据您的 Stormpath API key 自动生成的 =)

我们在最新的库版本中做出了许多新的更改,以启用各种新的、很酷的东西! <3

关于stormpath - 将 express-stormpath 与 node.js 一起使用时抛出“需要 apiKey.id”错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33251178/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com