wardencommunity/warden

Where does `user_deserialize` come from?

jon-mcclung-fortyau opened this issue · 1 comments

I am troubleshooting a larger issue where I am able to sign up using devise + google_oauth2 and then login but as soon as I refresh the page I am logged out. I have tracked it down to this line where (in my case) user_deserialize is called:

    def fetch(scope)
      key = session[key_for(scope)]
      return nil unless key

      method_name = "#{scope}_deserialize"
      user = respond_to?(method_name) ? send(method_name, key) : deserialize(key)
      delete(scope) unless user
      user
    end

send(method_name, key) is the problem. The first time I log in it returns the user correctly. However, if I even do as little as refresh the page this method then returns nil. My confusion is this: where does user_deserialize come from? That is the value of method_name above and respond_to?(method_name) returns true. I have done a global search for that within the codebases of warden, devise, and my own code and I cannot find it. I have checked method_missing but it didn't seem to be the cause. I think if I could get access to the code for that function I might be able to debug what's going on so I would really appreciate any help you can give. Thank you!

It is defined here:

Warden::SessionSerializer.send :define_method, method_name, &block