Search code examples
ruby-on-railsfacebookomniauthomniauth-facebook

Signing out of rails app when signed out of facebook


Haven't seen this question asked, but if something similar, please point me that way!

I learned the fb login from the railscast pro eps (http://railscasts.com/episodes/361-facebook-graph-api?view=asciicast) but can't get the logout to work properly when the user signs out of their facebook. I made the app "live" so sandbox mode shouldn't be an issue.

On the JS side, I have

  if $('#sign_out').length > 0
    Fb.getLoginStatus (response) ->
      window.location = $('#sign_out').attr("href") if !response.authResponse

And on the menu navbar, I have

 <li><%= link_to "Sign out", signout_path, id: "sign_out" %></li>

Seems to make sense to me... I don't use JS much so maybe I'm missing something simple


Solution

  • Ended up being something really stupid

    Fb needed to be capitalized

    FB.getLoginStatus (response) ->