omniauth strategy

This commit is contained in:
Zachary Chai
2016-10-17 14:26:31 -04:00
parent c32b48213a
commit 0d73a77f1f
10 changed files with 99 additions and 2 deletions

9
app/models/user.rb Normal file
View File

@ -0,0 +1,9 @@
class User < ApplicationRecord
def self.from_omniauth(auth_hash)
user = find_or_create_by(uid: auth_hash['uid'], provider: auth_hash['provider'])
user.name = auth_hash['info']['name']
user.save!
user
end
end