Topic: How to get access_token from Stripe within Rails app


I've been able to setup stripe for payment processing and am now trying to set it up so users can can process payments with Stripe Connect.

I'm able to get the authorization_code but I'm not able to get the access_token.
Using this Stripe Connect gem:

Clicking a link pointing to the following URL appears to properly redirect to the stripe sign / authorize screen:


Then the user gets redirected back to my app.

It's unclear to me what is the next step?  They get directed back to my app with the authorization_code. I want to take that code and make another request to get the access_token.

I've tried passing the proper parameteres to localhost:3000/auth/stripe_connect
According to the omniauth-stripe-connect documentation you can just post to that url and it will go to Stripe. This works for getting the authorization_code but seems to time out when attempting to use Net::HTTP.post_form to make a request.

And pointing the Net::HTTP.post_form request to stripe's token url, ""
returns the error :

  EOFError in UsersController#set_gateway_details

  end of file reached

begining test code...
The controller checks of there is a 'code' param and if so, attempts to get the token..


  def get_stripe_token_oauth(authorization_code)
    stripe_key ='____SECRET_KEY____'
    url = ""
    form_data = {
      'client_secret' => stripe_key,
      'grant_type'    => 'authorization_code',
      'code'          => authorization_code
   results = Net::HTTP.post_form(URI.parse(url), form_data) " #{results.inspect} Test Stripe Results"


So anyway I must be misunderstanding something with how to properly get the OAuth token / HTTP.post_form...

Is there any more information about setting up OAuth / rails and stripe somewhere? 


Last edited by internets (2013-05-27 19:27:42)