1

Ember アプリで Google と Facebook の認証を取得しようとしていますが、正しく設定できません。Google Developer Web サイトでプロジェクトを作成し、oAuth を追加し、Firebase で Google を有効にしました。https://www.firebase.com/docs/web/libraries/ember/guide.htmlで次の手順に従いました。

ember install torii

    // config/environment.js
/* ... */
    firebase: 'https://YOUR-FIREBASE-NAME.firebaseio.com/',
    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
{{#if session.isAuthenticated}}
  Logged in as {{session.currentUser.displayName}}
  <button {{action "signOut"}}>Sign out</button>
  {{outlet}}
{{else}}
  <button {{action "signIn" "twitter"}}>Sign in with Twitter</button>
{{/if}}

また、このスニペットを配置する場所もわかりません: this.get('session').open('firebase', { provider: 'password', email: 'test@example.com', password: 'password1234' }) ;

これらは私が得ていたエラーです:

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
4

1 に答える 1

0

firebase の Torii プロバイダー。

https://github.com/firebase/emberfire

もしかして、もう見てしまった?

ジェフ

于 2016-07-03T01:09:05.430 に答える