Prateek Darmwal
Prateek Darmwal

Reputation: 161

Getting error Faraday::ClientError: the server responded with status 400 on adding a share to linkedin in rails

I am trying to add a share using linkedin-oauth2 gem and getting an error

Faraday::ClientError: the server responded with status 400

I have also tried from irb but still getting same error. I have w_share permissions set for my access token but I don't know why I am getting this error. Here is a snippet of what m doing in my controller method->

def post_on_linkedin
  user = User.find_by_id(session[:user_id])
  @client = LinkedIn::API.new(user.token)
  @client.add_share(content: "hello")
  redirect_to social_media_linkedin_index_path
end

Please tell me if something is wrong with my syntax or anything else and please provide the syntax for using 'add_share' method with all other options. Thanks

Upvotes: 1

Views: 1667

Answers (0)

Related Questions