我正在使用 ember-simple-auth 和 ember-cli-facebook-js-sdk。我正在使用 ember-cli-facebook-sdk 因为我想随时获取用户照片,因为 facebook 只提供在 60 分钟内到期的访问权限.所以我也无法保存。Ember-cli-facebook-sdk 工作正常。但有时我的网络控制台出现错误。
{"error":{"message":"An active access token must be used to query information about the current user.","type":"OAuthException"}
我不知道为什么会出现这个错误。我有一个初始化程序,它有 facebook id 和 api 版本。现在我在我的控制器、组件和其他中使用 Fb.api 和其他人。但它有时会失败。请回答在哪里我错了。提前谢谢。
初始化程序/fb.js
import FB from 'ember-cli-facebook-js-sdk/fb';
export default {
name: 'fb',
initialize: function() {
return FB.init({
appId: '1234567',
version: 'v2.3',
xfbml: true
});
}
};
控制器.js
usrphoto:Ember.computed('model',function(){
var currentState = this;
FB.api('/me/picture','Get',{'type':'large'}).then(function(response) {
currentState.set('usrphoto', response.data.url)
})
}