-
-
Save havenwood/e516788b28a6e2f315017bfd35a7a237 to your computer and use it in GitHub Desktop.
Conversion of `curl -d 'grant_type=client_credentials&client_id=#{ api_key }&client_secret=#{ api_secret }' "https://api.gettyimages.com/oauth2/token"`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
require 'uri' | |
uri = URI.parse 'https://api.gettyimages.com/oauth2/token' | |
req_options = {use_ssl: true} | |
request = Net::HTTP::Post.new uri | |
params = {grant_type: 'client_credentials', | |
client_id: ENV['API_KEY'], | |
client_secret: ENV['API_SECRET']} | |
request.body = URI.encode_www_form params | |
response = Net::HTTP.start uri.hostname, uri.port, req_options do |http| | |
http.request request | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment