title: Stripe connect: linking standalone account in java
body: <p>I'm trying to set up stripe connect (<a href="https://stripe.com/docs/connect/standalone-accounts" rel="nofollow">https://stripe.com/docs/connect/standalone-accounts</a>) on my application, but I'm failing to set up the link between the platform and the standalone account. It provides a curl code to execute, and examples in ruby, python, PHP and node; but no java.</p>
  
  <p>The curl call is as follows:</p>
  
  <pre><code>curl https://connect.stripe.com/oauth/token \
  -d client_secret=sk_test_IgHHUgcqKmxA8Yyai9ocqpZR \
  -d code=AUTHORIZATION_CODE \
  -d grant_type=authorization_code
  </code></pre>
  
  <p>It looks pretty simple, but I have no idea how this works. I have been looking around trying to figure out how to make this call in java, and so far I haven't been able to. Taking code I found somewhere based on oltu and building on it, I came to the following:</p>
  
  <pre><code>OAuthClientRequest exchangeRequest = OAuthClientRequest
                  .tokenLocation("https://connect.stripe.com/oauth/token")
                  .setGrantType(GrantType.AUTHORIZATION_CODE)
                  .setParameter("client_secret", project.getPartnerStripeSecretAPIKey())
                  .setCode(authorizationCode)
                  .buildBodyMessage();
  
                  Map&lt;String,String&gt; headers =new HashMap&lt;String, String&gt;();
  
                  exchangeRequest.setHeaders(headers);
  
                 OAuthClient oAuthClient = new OAuthClient(new URLConnectionClient());
  
  
                 GitHubTokenResponse oAuthResponse = oAuthClient.accessToken(exchangeRequest, GitHubTokenResponse.class);
  
                 log.info("Stripe response: "+oAuthResponse.toString());
                 String accessToken = oAuthResponse.getAccessToken();
  </code></pre>
  
  <p>But it just fails with the following error: </p>
  
  <pre><code>OAuthProblemException{error='invalid_request', description='Missing parameters: access_token', uri='null', state='null', scope='null', redirectUri='null', responseStatus=0, parameters={}}
  </code></pre>
  
  <p>Could someone please let me know what I'm doing wrong, or recommend a better approach for the call (preferably with an example)?</p>
  
  <p>Thanks in advance</p>