如何将用户状态从节点赋予角度?

时间:2017-04-12 05:50:03

标签: angularjs node.js mean-stack passport.js

我在AngularJS中使用Nodejs。我正在尝试使用Passport建立身份验证系统。

facebook身份验证策略有效。当我点击 login.html 中的链接时,它会为我的MongoDB数据库创建一个新条目,并将其重定向到个人资料页面。

但是如何将用户状态归还给AngularJs应用? (对所有观点)

facebook身份验证路由

// route for facebook authentication and login
    app.get('/auth/facebook', passport.authenticate('facebook', { scope : 'email' }));

    // handle the callback after facebook has authenticated the user
    app.get('/auth/facebook/callback',
        passport.authenticate('facebook', {
            successRedirect : '/#!/profile',
            failureRedirect : '/failure'
        }));

的login.html

<a href="/auth/facebook" target="_self" class="btn btn-primary"><span class="fa fa-facebook"></span> Facebook</a>

0 个答案:

没有答案
相关问题