ruby on rails - Invalid authorization name/value {x-li-auth-token}/{NAME_SEARCH:tdLy} -
ruby on rails - Invalid authorization name/value {x-li-auth-token}/{NAME_SEARCH:tdLy} -
im working on linkedin invitation api can't send invitation user, using people id search result
seached people result
** "{\"people\":{\"total\":2,\"all\":[{\"api_standard_profile_request\":{\"headers\":{\"total\":1,\"all\":[{\"name\":\"x-li-auth-token\",\"value\":\"name_search:tdly\"}]},\"url\":\"http://api.linkedin.com/v1/people/tp2z82xa_i\"},\"first_name\":\"dev\",\"id\":\"tp2z8sad2xa_i\",\"last_name\":\"ruby\"},{\"api_standard_profile_request\":{\"headers\":{\"total\":1,\"all\":[{\"name\":\"x-li-auth-token\",\"value\":\"name_search:zby6\"}]},\"url\":\"http://api.linkedin.com/v1/people/tyaetfbxzl\"},\"first_name\":\"dev\",\"id\":\"tyaetfbsdsaxzl\",\"last_name\":\"ruby\"}]}}"**
and invite methods next
def send_invitation(options) path = "/people/~/mailbox" message = { "recipients" => { "values" => [ { "person" => { "_path" => "/people/id=#{options[:email]}", "first-name" => options[:first_name], "last-name" => options[:last_name] } }] }, "subject" => "invitation connect.", "body" => options[:body], "item-content" => { "invitation-request" => { "connect-type" => "friend", "authorization" => {"name" => "x-li-auth-token","value" => "name_search:tdly"} } } } post(path, multijson.dump(message), "content-type" => "application/json") end
so getting error when phone call client.send_invitation(options)
:
linkedin::errors::generalerror: (400): invalid authorization name/value {x-li-auth-token}/{name_search:tdly}
working fine
the name should name_search , value should tdly instead of have asked above. have split value out of oauth headers.
"authorization" => {:"name" => 'name_search',:"value" => 'tdly'}
ruby-on-rails ruby linkedin-gem
Comments
Post a Comment