Last active
November 17, 2022 12:31
-
-
Save maxloncar/790c2142b8e342efbed72b27f01f0ba0 to your computer and use it in GitHub Desktop.
Method to deal with the callback data
This file contains 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 self.find_for_oauth(provider_data) | |
user = User.where(provider: provider_data.provider, uid: provider_data.uid).first | |
unless user | |
user = User.create( | |
uid: provider_data.uid, | |
provider: provider_data.provider, | |
email: provider_data.info.email, | |
password: Devise.friendly_token[0, 20] | |
) | |
end | |
user | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment