Ruby on Rails
Saturday, May 26, 2012
On Friday, 25 May 2012 06:38:04 UTC-4, iDev wrote:
Hi all
I'm getting a 'Connection reset by peer' while getting an access token during oAuth from a third party API. Here's the code snippet:
def accesstoken
@code = params[:code]
url = URI.parse('access token request url')
req = Net::HTTP::Post.new(url.path)
req.set_form_data({'auth_code' => @code, 'client_id'=>'my_client_id', 'client_secret'=>'my_secret_key'}, ';')
Is there some particular reason you're using the semicolon separator here? Unless you've got a very weird server on the other end, the default separator for set_form_data (&) is almost certainly the correct thing to use.
Also note that, given that you're sending client_secret, you should be using SSL for this connection as well - see my reply to your earlier post.
--Matt Jones
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/41nzUvQIAh4J.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment