Yagiz
Yagiz

Reputation: 1033

best omniauth gem for rails

I am using Omniauth-facebook gem from Github from Ruby on Rails. I have several questions regarding the omniauth-facebook gem.

I am using the following function get the data from Facebook, but this function is called every time the user signs in and in registration.

def self.from_omniauth(auth)
where(auth.slice(:provider, :uid)).first_or_initialize.tap do |user|
    user.provider = auth.provider
    user.id = auth.uid
    user.uid = auth.uid
    user.name = auth.info.name
    user.username = auth.info.nickname
    user.email = auth.info.email
    user.gender = auth.extra.raw_info.gender
    user.is_admin = false
    user.picture = "http://graph.facebook.com/#{auth.uid}/picture?type=large&height=324&width=580"
    user.updated_at = auth.extra.raw_info.updated_time
    user.oauth_token = auth.credentials.token
    user.oauth_expires_at = Time.at(auth.credentials.expires_at)
    user.save!
end
end

How can I differ the registration and login function from each other?

On the other hand, I want to post the user's wall something when the user signs in, or posts something. How can I do it in Omniauth-facebook gem?

Thank you.

Upvotes: 0

Views: 119

Answers (1)

Sagar.Patil
Sagar.Patil

Reputation: 991

Omniauth-facebook gem is best if want to add any post on users wall u can refer this link

facebook share

Upvotes: 1

Related Questions