admin管理员组文章数量:1416331
I'm using a custom Facebook authenticator, very similar to the one given in the ember-simple-auth example. I inject the properties accountID
and accessToken
into the session here:
if (fbResponse.status === 'connected') {
console.log("AccountID: " + fbResponse.authResponse.userID);
Ember.run(function() {
resolve({
accessToken: fbResponse.authResponse.accessToken,
accountID: fbResponse.authResponse.userID
});
});
If I read the docs correctly, I should be able to access accountID
using session.accountID
in any controller. But, the only way I can find this is via session.store._lastData.accountID
, which is probably not the right way to do it.
More specifically, in a controller, I have an action:
createRental: function() {
var session = this.get('session');
console.log(session.accountID); // undefined
console.log(session.store._lastData.accountID); // '123456'
Does anyone with experience using ember-simple-auth know what the issue is? Thanks!
I'm using a custom Facebook authenticator, very similar to the one given in the ember-simple-auth example. I inject the properties accountID
and accessToken
into the session here:
if (fbResponse.status === 'connected') {
console.log("AccountID: " + fbResponse.authResponse.userID);
Ember.run(function() {
resolve({
accessToken: fbResponse.authResponse.accessToken,
accountID: fbResponse.authResponse.userID
});
});
If I read the docs correctly, I should be able to access accountID
using session.accountID
in any controller. But, the only way I can find this is via session.store._lastData.accountID
, which is probably not the right way to do it.
More specifically, in a controller, I have an action:
createRental: function() {
var session = this.get('session');
console.log(session.accountID); // undefined
console.log(session.store._lastData.accountID); // '123456'
Does anyone with experience using ember-simple-auth know what the issue is? Thanks!
Share Improve this question asked Mar 25, 2014 at 13:37 abeinsteinabeinstein 5524 silver badges11 bronze badges1 Answer
Reset to default 6You need to use get
:
this.get('session.accountID')
or
var session = this.get('session');
session.get('accountID')
本文标签: javascriptHow do I access session properties in embersimpleauthStack Overflow
版权声明:本文标题:javascript - How do I access session properties in ember-simple-auth? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745250046a2649768.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论