title: Stripe Connect - retrieving access token
body: <p>I am trying to set up Stripe Connect for a rails 3.2.13 app. I have directed the user to Stripe and received back the authorization code from Stripe:</p>
  
  <pre><code>HTTP/1.1 302 Found
  Location: http://localhost:3000/yourshop/stripe?scope=read_write&amp;state=1234&amp;code=AUTHORIZATION_CODE
  </code></pre>
  
  <p>The next step involves making a POST request to receive the access_token via the access_token_url, per Stripe documentation:</p>
  
  <pre><code>curl -X POST https://connect.stripe.com/oauth/token \
    -d client_secret=sk_test_code \
    -d code=AUTHORIZATION_CODE \
    -d grant_type=authorization_code
  </code></pre>
  
  <p>I don't have any experience with curl is a rails app and I couldn't find anything in the Stripe API that seems like this POST request is include in the Stripe Gem:</p>
  
  <p>Gem file:</p>
  
  <pre><code>gem 'omniauth-stripe-connect'
  gem 'stripe'
  </code></pre>
  
  <p>Model</p>
  
  <pre><code>def save_with_stripe_account
    code = self.stripe_code
    customer = curl -X POST https://connect.stripe.com/oauth/token \
      -d "client_secret=ENV['STRIPE_SECRET_KEY']" \
      -d "code=code" \
      -d "grant_type=authorization_code"
    raise customer.inspect  
  end
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>syntax error, unexpected tCONSTANT, expecting keyword_do or '{' or '('
  </code></pre>
  
  <p>Not sure if just the wrong formatting for curl in rails or if need to use something else.</p>