angularjs - Stormpath not letting me access a route when logged in -


i trying learn how use stormpath express. have fullstack angular/node project generated yeoman , angular-fullstack generator. got login, register , forgot password work. when want add restriction on 1 of routes works logged in users, won't let pass.

i initialise stormpath in app.js on server this:

var stormpath = require('express-stormpath'); app.use(stormpath.init(app, {     apikeyid: 'xxxxxxxxxxxxxxxxxxx',     apikeysecret: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',     application: 'https://api.stormpath.com/v1/applications/xxxxxxxxxxxxxxxxxxx',     secretkey: 'xxxxxxxxxxxxxxxxxxx',     expandcustomdata: true,     enableforgotpassword: true })); 

my route in api index.js file looks this:

var express = require('express'); var stormpath = require('express-stormpath'); var router = express.router();  router.post('/:id/vote', stormpath.loginrequired, function(req, res){     console.log("user clicked vote button!");     console.log("user e-mail: "+res.user.email); }); 

and problem experiencing when call post route, no logs @ all. logged in on site seems doesn't let me access route. if remove stormpath.loginrequired, works, missing user data.

thank help!

the express-stormpath module isn't yet designed use single-page applications angular. have seperate (beta!) module designed angular: stormpath-sdk-express

we have detailed guide explains how use module angular:

https://docs.stormpath.com/angularjs/guide/

note: actively working on combining these modules, there future release combine features one.

hope helps!


Comments