我们的 RoR 应用程序有问题。我们正在使用带有omniauth 的facebook 身份验证,并使用Koala 搜索用户朋友。但是最近,当我们尝试显示朋友照片时,我们得到了这个错误:
Koala::Facebook::APIError in Homes#show
Showing /home/daniel/Homes/app/views/shared/_event.html.erb where line #19 raised:
OAuthException: Error validating access token: Session has expired at unix time 1328727600. The current unix time is 1328802133.
Extracted source (around line #19):
16: <img src="../assets/friends-icon.png" alt="User profile apicture" height="33" width="43">
17: <% if current_user %>
18: <% event.friends_in_event(@person).each do |f| %>
19: <%= link_to(image_tag(f.fb_picture, :size => "43x33"), person_path(f.id)) %>
20: <% end %>
21: <% end %>
22: </div>
身份验证运行良好,但 facebook 已经弃用了 offline_access 选项,该选项运行良好,但现在,我们遇到了这个问题。有什么方法可以扩展 access_token 吗?还是有其他解决方案?
这是我们的omniauth.rb
Rails.application.config.middleware.use OmniAuth::Builder do
provider :facebook, ENV['FB_KEY'], ENV['FB_SECRET'],
{ :scope => 'email,offline_access,user_photos,publish_stream',
:client_options => { :ssl => { :ca_path => "/etc/ssl/certs" } } }
end
还有我们的考拉.rb
Koala.http_service.http_options = {
:ssl => { :ca_path => "/etc/ssl/certs" }
}
提前致谢。