Created
April 19, 2013 07:06
-
-
Save bornfree/5418621 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def add_provider(auth_hash) | |
unless auth_existing = authorizations.find_by_provider_and_uid(auth_hash["provider"], auth_hash["uid"]) | |
# No auth exists for this provider. Create one and update keys. | |
auth = Authorization.create :user => self, :provider => auth_hash["provider"], :uid => auth_hash["uid"] | |
auth.update_access_keys(auth_hash) | |
else | |
# Auth already exists but we need to update the access_tokens | |
auth_existing.update_access_keys(auth_hash) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment