app/controllers/stormpath/rails/linkedin/create_controller.rb
module Stormpath
module Rails
module Linkedin
class CreateController < Stormpath::Rails::SocialController
def call
begin
login_the_account(account)
respond_with_success
rescue InvalidSptokenError, NoSptokenError => error
respond_with_error(error)
end
end
private
def account_request
Stormpath::Provider::AccountRequest.new(:linkedin, :code, params[:code])
end
def account
Stormpath::Rails::Client.application.get_provider_account(account_request).account
end
end
end
end
end