Hi I want to get a custom JSON file from the stormpath API in a normal JS function instead of within a view.
The view method is like this:
var stormpath = require('express-stormpath');
app.get('/email', stormpath.loginRequired, function(req, res) {
res.send('Your email address is:', res.locals.user);
});
However when I attempt to just use the method like this:
var customD = res.send('Your email address is:', res.locals.user);
it returns an unexpected token ' ( ' error
In the posted example the quotation marks ’
are a rich encoded, not the standard single '
or double quotes "
. I would replace your quotes with single quotes. What text editor are you using to write your node application?
Regarding the original question about custom data, can you show us how you are assigning the custom data properties? I suspect that you might have run into this issue: https://github.com/stormpath/stormpath-sdk-node/issues/88
Can you try the following code sample?
var stormpath = require('express-stormpath');
app.get('/email', stormpath.loginRequired, function(req, res) {
res.send('Your email address is:' + res.locals.user.email);
});
I suspect a few things: