Authentication and user data through application

Hi all,

Short introduction; Im new to Ember and been playing with it for 3 weeks now. I really like ember and working with it. I created several test project to play with the possibilities and see how everything works.

Now im using it for a new ‘real’ project im building and everything was going fine until i reached the part of the user logging in with Facebook and store/use its data in my app. I find it hard to create a centralized way of saving the user data and keep the log-in/logout/registration functionalities together.

At the moment i tried to create and AutthenticationManager which is an Ember object and have the login and logout stuff there and call that from an Controller. That works fine but than i want to render/change the view/template with new data and im not finding a good solution to make that work. I thought of having an User model and keep that also in the AuthenticationManger but than i need to include my AuthManager everywhere where i need the user data which is in like every view probably.

So what is a good way of creating an centralized login/logout controller and store the user data in a model which i can easily access throughout my application.

Thanks for reading my situation and i hope you guys can help me find a nice structure.

  • Rolf
1 Like

Have you tried https://github.com/luan/ember-facebook

You should save the login, logout actions to the application route, that way, it can bubble from anywhere in your application to the Application Route.

Also, I would store the authenticated user as a property on the Application route, then in any other controller I can say

needs:['application']

and I would be able to access the user data.