I've followed the EmberFire guide to setting up authentication with the torii provider and it works perfectly. I'm looking to store the users data in firebase after the user has been authenticated and to have access to the user object throughout the application.
I have previously done this with ember awhile back but i'm unsure how to do it using the new torii provider.
I'm thinking i should test wether the user is already stored in firebase in an initialiser function and then inject the user into the controllers/routes.
Any help pointing me in the right direction would be helpful or some example code.
Thanks
You need a Torii adapter that implements
open
andfetch
and does afind
/save
to your app specific user model. Our ToriiFirebaseAdapter does not do this, yet. I've gone ahead and knocked one up for you that will work:All you need to do is update the
extractUserProperties
method to get the properties you care about into their correct place on your user model - everyone implements their user model differently.Now you should be able to look up
session.currentUser
and it will return an Ember Data model that corresponds to the logged in user.Hope that helps. We are in the process of adding this to the website documentation and will try to find a way to roll this into the EmberFire supplied ToriiFirebaseAdapter.