reme
reme

Reputation: 183

how to authenticate with httparty?

I'am trying to query LinkedIn with Httparty, but it returns an 401 error :

<error>
  <status>401</status>
  <timestamp>1438869780537</timestamp>
  <request-id>1JWX1OVLFT</request-id>
  <error-code>0</error-code>
  <message>Unknown authorization header {Basic cmVteXVram9iQGdtYWlsLmNvbTptdW5kZDIwMTQ=}</message>
</error>

I do not know how to login to LinkedIn with httparty.

My script:

require 'httparty'
  
  auth = {:username => "[email protected]", :password => "password"}
 @blah = HTTParty.get("https://api.linkedin.com/v1/people-search?keywords=[sap]", 
                     :basic_auth => auth)

I followed several tutorials, but no luck. In the code above it use my login, but I think I should use Api key

Thanks.

Upvotes: 1

Views: 1509

Answers (1)

Axel Tetzlaff
Axel Tetzlaff

Reputation: 1364

I their documentation they write:

At LinkedIn, we value the integrity and security of our members' data above all else. In order for your applications to access LinkedIn member data and/or act on their behalf, they must be authenticated. LinkedIn relies on the industry standard OAuth 2.0 protocol for granting access, due to its simplicity and ease of implementation.

Please read our Authenticating with OAuth 2.0 guide for a detailed walk-through of how to get your application authenticated and successfully interacting with LinkedIn's REST APIs.

Did you read that guide about OAuth?

Upvotes: 1

Related Questions