Heroku 앱에서 express-stormpath를 사용하려고합니다. 나는 여기에 문서를 다음과 같은거야, 내 코드는 매우 간단하다 :apiKey 키 ID와 암호가 급행 폭풍 경로에 있어도 필수입니다.
var express = require('express');
var app = express();
var stormpath = require('express-stormpath');
app.use(stormpath.init(app, {
website: true
}));
app.on('stormpath.ready', function() {
app.listen(3000);
});
가 이미 this question 보았고 Heroku devcenter docs을 따랐습니다. 문서에서는 Heroku 앱의 경우 옵션을 전달할 필요가 없지만 옵션을 전달하려고 시도했지만 아무 것도 작동하지 않는다고 말합니다. 예를 들어, 나는이 시도했다 :
app.use(stormpath.init(app, {
// client: {
// file: './xxx.properties'
// },
client: {
apiKey: {
file: './xxx.properties',
id: process.env.STORMPATH_API_KEY_ID || 'xxx',
secret: process.env.STORMPATH_API_KEY_SECRET || 'xxx'
}
},
application: {
href: 'https://api.stormpath.com/v1/applications/blah'
},
}));
시도하고 무슨 일이 일어나고 있는지 확인하려면, 나는 클라이언트 개체를 인쇄 할 stormpath-config strategy valdiator에 CONSOLE.LOG 라인을 추가하고, 나에게이 제공 :
{ file: './apiKey-xxx.properties',
id: 'xxx',
secret: 'xxx' }
{ file: null, id: null, secret: null }
Error: API key ID and secret is required.
을
두 번 호출되는 이유는 무엇입니까? 두 번째로 클라이언트 개체가 파일, ID 및 암호에 대해 null 값을 갖는 이유는 무엇입니까?
내가 heroku config | grep STORMPATH
를 실행하면, 나는 끝없는 시간 후, 나는 마침내 완전히 추가 기능을 제거하고 Heroku가 CLI를 통해 그것을 다시 설치 한 후 수출에 의해 작동 얻을 관리
STORMPATH_API_KEY_ID: xxxx
STORMPATH_API_KEY_SECRET: xxxx
STORMPATH_URL: https://api.stormpath.com/v1/applications/[myappurl]
'heroku config |의 출력은 무엇입니까? grep STORMPATH'? Heroku에서 잘못된 환경 변수가 채워질 수 있습니다. –
편집 된 env 변수가 올바르게 설정되어 있지만 ValidateClientConfigStrategy.js가 여전히 {{file : null, id : null, secret : null} '을 인쇄하고 있습니다. – arete
'heroku config : set' ([docs] (https : /devcenter.heroku.com/articles/config-vars#setting-up-config-vars-for-a-deployed-application)) 대신에 환경 변수 인'STORMPATH_CLIENT_APIKEY_ID','STORMPATH_CLIENT_APIKEY_SECRET','STORMPATH_APPLICATION_HREF'를 설정하십시오. –