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
そして私たちの koala.rb
Koala.http_service.http_options = {
:ssl => { :ca_path => "/etc/ssl/certs" }
}
前もって感謝します。