ruby - How to display linkedin profile information in Rails -
ruby - How to display linkedin profile information in Rails -
i'm working on app have linkedin sign in button. 1 time user signs in using linkedin in username , password. want display info on home page.
currently i'm using 'omniauth', 'omniauth-linkedin-oauth2' authenticate user. person working on before me completed authentication process can't understand how display users info. authentication implemented next railscast #235 & #236 omniauth part 1 , 2.
this omniauth.rb file.
rails.application.config.middleware.use omniauth::builder provider :linkedin, 'linkedin_key', 'linkedin_secret', :scope => 'r_fullprofile r_emailaddress r_network', :fields => ['id', 'email-address', 'first-name', 'last-name'] end
i want display fields omniauth.rb file. understand silly issue i'm new ruby on rails i'd appreciate if can guide me through process.
based on authentications controller in part 2 can fields omniauth hash:
omniauth = request.env["omniauth.auth"] first_name = omniauth[:info][:first_name] last_name = omniauth[:info][:last_name] summary = omniauth[:extra][:raw_info][:summary] headline = omniauth[:extra][:raw_info][:headline] image = omniauth[:info][:image] email = omniauth[:info][:email] token = omniauth[:credentials][:token] secret = omniauth[:credentials][:secret] profile_url = omniauth[:info][:urls][:public_profile]
those basic info need authentication hash, if need more data, can utilize next gem (using user's token):
gem 'linkedin-oauth2', '~> 0.1.1'
ruby ruby-on-rails-3 oauth-2.0 linkedin omniauth
Comments
Post a Comment