이미 사용자 계정이있는 것처럼 나에게 들리며 사용자 정의 데이터를 가져 와서 물건을 저장하려고합니다. 맞습니까?
그래서, 여기 당신이 할 수있는 방법은 다음과 같습니다
app.get('/test', function(req, res) {
var account = ...; // I'm assuming you already have an account.
account.getCustomData(function(err, data) {
if (err) res.send(500).end()
res.json(data);
});
});
위의 경로를 JSON으로 사용자의 사용자 정의 데이터를 반환합니다. 다음은
나는 사용자 정의 데이터에 몇 가지 물건을 저장할 수 있습니다 예입니다, 다음 Stormpath에 지속 :
app.get('/test', function(req, res) {
var account = ...; // I'm assuming you already have an account.
account.getCustomData(function(err, data) {
if (err) res.send(500).end()
data.favorites = ['cookies', 'and', 'cream'];
data.pet = {
type: 'dog',
name: 'Scribbles',
breed: 'chihuahua',
color: 'brindle'
};
data.save(function(done) {
res.json({ message: 'Finished saving data to Stormpath!' });
});
});
});
당신이 [Stormpath 노드 SDK (https://github.com/stormpath를 사용하고 있습니까/stormpath-sdk-node) 또는 [stormpath-express] (https://github.com/stormpath/stormpath-express)와 같은 통합 중 하나입니까? – robertjd
노드 SDK를 사용하고 있는데,이 문서 [stormpath and node] (https://stormpath.com/blog/build-app-nodejs-express-passport-stormpath/)에서 작업하고있었습니다. 제 말대로 사용자가 로그인했을 때 사용자 데이터에 액세스하는 기능이 작동하지 않습니다. 이미 여러 노드 북을 읽었지만 여전히이를 수행 할 방법을 볼 수 없습니다. – CHeffernan087
몇 가지를 시도했습니다. 실제로는 어둠 속에서도 찔러 보았습니다. 노드를 사용하는 데 익숙하지 않습니다. – CHeffernan087