2017-06-05 94 views
0

我開始越來越托裏和餘燼爲登錄頁面的工作,但是當我嘗試使用與Ember簡單的身份驗證我得到的錯誤:燼-簡單權威性和牌坊火力類型錯誤:轉換圓形結構,以JSON

TypeError: Converting circular structure to JSON 
    at JSON.stringify (<anonymous>) 
    at Class.persist (local-storage.js:45) 
    at Class.persist (adaptive.js:163) 
    at Class._callStoreAsync (internal-session.js:132) 
    at Class._updateStore (internal-session.js:207) 
    at Class._setup (internal-session.js:156) 
    at internal-session.js:61 
    at tryCatch (ember.debug.js:50180) 
    at invokeCallback (ember.debug.js:50195) 
    at publish (ember.debug.js:50163) 

不知道它的bug或我失去了一些東西,需要設置。很快做出了回購這說明我的問題https://github.com/tobias-g/ember-simple-auth-firebase其中差異https://github.com/tobias-g/ember-simple-auth-firebase/commit/02882f4db3a0320d4ac314d2e92192ac522470f8顯示我添加了什麼嘗試並獲得燼簡單的身份驗證工作。

DEBUG: ------------------------------- 
DEBUG: Ember    : 2.13.3 
DEBUG: Ember Data  : 2.13.1 
DEBUG: Firebase   : 3.9.0 
DEBUG: EmberFire   : 0.0.0 
DEBUG: jQuery   : 3.2.1 
DEBUG: Ember Simple Auth : 1.3.0 
DEBUG: ------------------------------- 
+1

你知道,Firebase擁有自己的已經使用Torii的認證系統。我不知道你在做什麼用例是,但我發現灰燼,簡單權威性和火力地堡是多餘的。 https://github.com/firebase/emberfire/blob/master/docs/guide/authentication.md – Cameron

+0

是啊,我得到了火力認證的第一工作正常提交,但想用餘燼,簡單AUTH DataAdapterMixin我模型和AuthenticatedRouteMixin的路線。如果我不能修復它,我會想我必須處理我自己沒有混入,可能有寫一點樣板代碼。 – Tobias

回答

0

Emberfire發回的data.authenticated負載過於複雜,並且有循環引用。灰燼簡單驗證存儲該有效載荷到本地存儲,以防止登錄提示時,清新的或其他選項卡上打開的應用程序。

什麼似乎現在爲我工作(我沒有測試太多)是擴展會議商店。因人而異。

// app/session-stores/application.js 

import AdaptiveStore from 'ember-simple-auth/session-stores/adaptive'; 

export default AdaptiveStore.extend({ 

    persist(data) { 
    const a = data.authenticated; 

    const subset = { 
     authenticator: a.authenticator, 
     email: a.email, 
     provider: a.provider, 
     refreshToken: a.refreshToken, 
     uid: a.uid 
    } 

    return this._super({ authenticated: subset }); 
    } 

}); 
相關問題