Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Where does user_deserialize come from? #210

Open
jon-mcclung-fortyau opened this issue Jul 12, 2023 · 1 comment
Open

Where does user_deserialize come from? #210

jon-mcclung-fortyau opened this issue Jul 12, 2023 · 1 comment

Comments

@jon-mcclung-fortyau
Copy link

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!

@jsmestad
Copy link
Collaborator

It is defined here:

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants