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

Provider and UID attributes aren't getting set #53

Closed
alininja opened this issue Apr 23, 2013 · 0 comments
Closed

Provider and UID attributes aren't getting set #53

alininja opened this issue Apr 23, 2013 · 0 comments

Comments

@alininja
Copy link

Hi,

I tried to follow this tutorial:
https://github.com/intridea/omniauth/wiki/Managing-Multiple-Providers

but came into an issue where the Identity records were getting created with the provider and uid attributes not set.

I'm trying omniauth-identity out on rails 4.0.0.beta1. So my best guess is that strong_parameters aren't allowing these attributes to be mass-assigned? I'm not sure how strong_parameters work with Rack middleware or if I'm just totally off the mark.

The work around for me was to replace:

def self.create_with_omniauth(auth)
  create(uid: auth['uid'], provider: auth['provider'])
end

with something along the lines of

def self.find_and_update_with_omniauth(auth, password)
  identity = find(auth['uid'])
  identity.update_attributes(uid: auth['uid'],
                             provider: auth['provider'],
                             email: auth['info']['email'],
                             password: password)
  identity.save
  identity
end

It's definitely not elegant and I'm not sure if it's solving the root cause of the issue, but just wanted to give you a heads up.

Just out of curiousity, it seems like identity.uid is the same as identity.id. Is it there to keep things consistent with other strategies (since Twitter might pass along a UID that's not tied to an actual record ID)?

Thanks for making such an awesome system!

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

1 participant