I am trying to get Authentication with Google and Facebook in my Ember app, but I cannot properly configure it. I created the project on the google developer website, added oAuth, and enabled Google on Firebase. I followed these steps on http://ift.tt/1x2r85r:
ember install torii
// config/environment.js
/* ... */
firebase: 'http://ift.tt/1MmBI8E',
torii: {
sessionServiceName: 'session'
}
/* ... */
// torii-adapters/application.js
import Ember from 'ember';
import ToriiFirebaseAdapter from 'emberfire/torii-adapters/firebase';
export default ToriiFirebaseAdapter.extend({
firebase: Ember.inject.service()
});
// app/routes/application.js
import Ember from 'ember';
export default Ember.Route.extend({
beforeModel: function() {
return this.get("session").fetch().catch(function() {});
},
actions: {
signIn: function(provider) {
this.get("session").open("firebase", { provider:provider}).then(function(data) {
console.log(data.currentUser);
});
},
signOut: function() {
this.get("session").close();
}
}
});
// app/templates/application.hbs
Logged in as
<button >Sign out</button>
<button >Sign in with Twitter</button>
I also have no idea where to put this snippet: this.get('session').open('firebase', { provider: 'password', email: 'test@example.com', password: 'password1234' });
These are the errors that I was getting:
Error while processing route: profile this.get(...) is undefined beforeModel@http://localhost:4200/assets/announce-me.js:245:14
applyHook@http://localhost:4200/assets/vendor.js:61326:16
HandlerInfo.prototype.runSharedModelHook@http://localhost:4200/assets/vendor.js:59517:20
HandlerInfo.prototype.runBeforeModelHook@http://localhost:4200/assets/vendor.js:59491:14
bind/<@http://localhost:4200/assets/vendor.js:61196:14
tryCatch@http://localhost:4200/assets/vendor.js:61543:14
invokeCallback@http://localhost:4200/assets/vendor.js:61558:15
publish@http://localhost:4200/assets/vendor.js:61526:9
@http://localhost:4200/assets/vendor.js:41428:7
Queue.prototype.invoke@http://localhost:4200/assets/vendor.js:10459:9
Queue.prototype.flush@http://localhost:4200/assets/vendor.js:10523:11
DeferredActionQueues.prototype.flush@http://localhost:4200/assets/vendor.js:10331:11
Backburner.prototype.end@http://localhost:4200/assets/vendor.js:10686:9
Backburner.prototype.run@http://localhost:4200/assets/vendor.js:10808:13
Backburner.prototype.join@http://localhost:4200/assets/vendor.js:10828:16
run.join@http://localhost:4200/assets/vendor.js:30439:12
run.bind/<@http://localhost:4200/assets/vendor.js:30502:14
jQuery.Callbacks/fire@http://localhost:4200/assets/vendor.js:3498:11
jQuery.Callbacks/self.fireWith@http://localhost:4200/assets/vendor.js:3628:7
.ready@http://localhost:4200/assets/vendor.js:3847:3
completed@http://localhost:4200/assets/vendor.js:3863:2
vendor.js:37856:5
beforeModel@http://localhost:4200/assets/announce-me.js:245:14
applyHook@http://localhost:4200/assets/vendor.js:61326:16
HandlerInfo.prototype.runSharedModelHook@http://localhost:4200/assets/vendor.js:59517:20
HandlerInfo.prototype.runBeforeModelHook@http://localhost:4200/assets/vendor.js:59491:14
bind/<@http://localhost:4200/assets/vendor.js:61196:14
tryCatch@http://localhost:4200/assets/vendor.js:61543:14
invokeCallback@http://localhost:4200/assets/vendor.js:61558:15
publish@http://localhost:4200/assets/vendor.js:61526:9
@http://localhost:4200/assets/vendor.js:41428:7
Queue.prototype.invoke@http://localhost:4200/assets/vendor.js:10459:9
Queue.prototype.flush@http://localhost:4200/assets/vendor.js:10523:11
DeferredActionQueues.prototype.flush@http://localhost:4200/assets/vendor.js:10331:11
Backburner.prototype.end@http://localhost:4200/assets/vendor.js:10686:9
Backburner.prototype.run@http://localhost:4200/assets/vendor.js:10808:13
Backburner.prototype.join@http://localhost:4200/assets/vendor.js:10828:16
run.join@http://localhost:4200/assets/vendor.js:30439:12
run.bind/<@http://localhost:4200/assets/vendor.js:30502:14
jQuery.Callbacks/fire@http://localhost:4200/assets/vendor.js:3498:11
jQuery.Callbacks/self.fireWith@http://localhost:4200/assets/vendor.js:3628:7
.ready@http://localhost:4200/assets/vendor.js:3847:3
completed@http://localhost:4200/assets/vendor.js:3863:2
Aucun commentaire:
Enregistrer un commentaire