Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8236471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:08:43+00:00 2026-06-07T19:08:43+00:00

The following curl command works as expected: curl ‘https://graph.facebook.com/oauth/access_token?grant_type=client_credentials&client_id=myappid&client_secret=myclientsecret’ I want to do the

  • 0

The following curl command works as expected:
curl 'https://graph.facebook.com/oauth/access_token?grant_type=client_credentials&client_id=myappid&client_secret=myclientsecret'

I want to do the same thing in my Ruby program. The following code gives me an error:

fb_access_token_url = URI.parse(                                             
    'https://graph.facebook.com/oauth/access_token' +                        
    '?grant_type=client_credentials' +                                       
    '&client_id=' + FACEBOOK_APP_ID +                                        
    '&client_secret=' + FACEBOOK_APP_SECRET)                                 
fb_access_token = Net::HTTP.get(fb_access_token_url)                         

So does this code:

fb_access_token_host = 'graph.facebook.com'                                  
fb_access_token_path_and_params = (                                          
    '/oauth/access_token' +                                                  
    '?grant_type=client_credentials' +                                       
    '&client_id=' + FACEBOOK_APP_ID +                                        
    '&client_secret=' + FACEBOOK_APP_SECRET)                                 
https_port = Net::HTTP.https_default_port()                                  

fb_access_token = Net::HTTP.get_response(fb_access_token_host,               
                                         fb_access_token_path_and_params,       
                                         https_port)

The error is as follows:

Errno::ECONNRESET: Connection reset by peer
/usr/lib/ruby/1.8/net/protocol.rb:135:in `sysread'
/usr/lib/ruby/1.8/net/protocol.rb:135:in `rbuf_fill'
/usr/lib/ruby/1.8/timeout.rb:67:in `timeout'
/usr/lib/ruby/1.8/timeout.rb:101:in `timeout'
/usr/lib/ruby/1.8/net/protocol.rb:134:in `rbuf_fill'
/usr/lib/ruby/1.8/net/protocol.rb:116:in `readuntil'
/usr/lib/ruby/1.8/net/protocol.rb:126:in `readline'
/usr/lib/ruby/1.8/net/http.rb:2028:in `read_status_line'
/usr/lib/ruby/1.8/net/http.rb:2017:in `read_new'
/usr/lib/ruby/1.8/net/http.rb:1051:in `request'
/usr/lib/ruby/1.8/net/http.rb:948:in `request_get'
/usr/lib/ruby/1.8/net/http.rb:380:in `get_response'
/usr/lib/ruby/1.8/net/http.rb:543:in `start'
/usr/lib/ruby/1.8/net/http.rb:379:in `get_response'
/usr/lib/ruby/1.8/net/http.rb:356:in `get'
./test-login-and-registration.rb:182:in `test_facebook_register'

I’m using Ruby 1.8.7 on Ubuntu 12.04

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T19:08:45+00:00Added an answer on June 7, 2026 at 7:08 pm

    Thanks to Manoj Awasthi for making me realize that there were ssl methods that I couldn’t use.

    The problem was that I was requiring net/http rather than net/https.

    Working snippet:

    fb_access_token_url = URI.parse(                                             
        'https://graph.facebook.com/oauth/access_token' +                        
        '?grant_type=client_credentials' +                                       
        '&client_id=' + FACEBOOK_APP_ID +                                        
        '&client_secret=' + FACEBOOK_APP_SECRET)                                 
    https = Net::HTTP.new(fb_access_token_url.host, fb_access_token_url.port)    
    https.use_ssl = true                                                         
    https.verify_mode = OpenSSL::SSL::VERIFY_NONE                                
    fb_access_token = https.request_get(fb_access_token_url.path + '?' +         
                                        fb_access_token_url.query)               
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need a transformation of the following working curl command: curl --data-binary @data.txt http://www.example.com/request.asp
the following msbuild Exec statement <Exec Command=curl.exe -f -O --url &quot;$(SourceURL)&quot;> fails if SourceURL
After installing rvm, using the following: $ curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer > rvm-installer $ bash
The following curl statement works OK in my shell script. curl -Ld'username=user&password=password&source=oksoft&dmobile='$mnumber'&message=Slave is working
when I get the following url with curl curl -D headers.http http://www.springerlink.com/index/10.1007/s00453-007-9157-8 the file
What would the following cURL command look like as a generic (without cURL) http
I am trying to download flurry exception logs using the following command. curl --cookie
How can I rewrite the following CURL command, so that it doesn't use the
I am having problems converting the following curl command into PyCurl: curl -k --cert
From bash terminal, I successfully executed the following command. curl -v -L -F file='@/var/www/dev/public_html/sixties.mov'

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.