-
Notifications
You must be signed in to change notification settings - Fork 216
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
token.user_id won't save, but only in Rails 3.1 for the consumer #96
Comments
Could the bang be the culprit? |
Here is my debugger log that from a Twitter callback:
Something goes wrong during the INSERT that @yutai overwrites with an UPDATE... |
Solved: Probable Devise method conflict - Rename/replace create_user
|
Wow, great find! Been struggling with the same issue for a few hours now. Thanks. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ok, I know there's already been a few posts on this one already...
#88
#84
I've tried to build the sample provider-consumer from the excellent tutorial
http://unhandledexpression.com/2011/06/02/rails-and-oauth-plugin-part-1-the-provider/
http://unhandledexpression.com/2011/06/28/rails-and-oauth-plugin-part-2-the-consumer/
I've followed all the fixes, edits, of that tutorial including the advice to add
def current_user=(user)
current_user = user
end
to the consumer's application controller
and it works great when running 3.0.7 on the consumer. The provider works regardless of 3 vs 3.1
When running the consumer in 3.1, the user_id keeps saving as nil when saving the token.
Trying to debug into the gem, i found something maddening:
if i go to the token model of the gem,
https://github.com/pelle/oauth-plugin/blob/master/lib/oauth/models/consumers/token.rb
in the def for
find_or_create_from_access_token
before line 51, which is
if i log token.user_id, it outputs the right user id.
but after it saves on line 51, log for token.user_id becomes nil
and then, if i just add two more lines after line 51, where it saved the token,
magic. it saves the user_id now in the token.
why in the world did it not save it the first time?
and why does this not happen in 3.0.7?
Thanks for reading this far down my messy post.
The text was updated successfully, but these errors were encountered: