title: stripe connect identity verification using angular http post
body: <p>I am using the ng-file-upload directive to send a image file to my angular controller. <a href="https://github.com/danialfarid/ng-file-upload" rel="nofollow noreferrer">https://github.com/danialfarid/ng-file-upload</a></p>
  
  <p>Inside my angular controller I am trying to translate this curl post from the stripe API docs into a http post. <a href="https://stripe.com/docs/connect/authentication" rel="nofollow noreferrer">https://stripe.com/docs/connect/authentication</a></p>
  
  <pre><code>curl https://files.stripe.com/v1/files \
     -u {PLATFORM_SECRET_KEY}: \
     -H "Stripe-Account: {CONNECTED_STRIPE_ACCOUNT_ID}" \
     -F purpose=identity_document \
     -F file="@/path/to/a/file"
  </code></pre>
  
  <p>My code:</p>
  
  <pre><code>Upload.upload({
     url: "https://files.stripe.com/v1/files",
     method: "POST",
     headers: {
       "Authorization": "Bearer SK_Test_key",
       "Stripe-Account": "connected_acct_id",
        },
     data: {
       "purpose": "identity_document",
       file: file
      }
  })...
  </code></pre>
  
  <p>this returns a 401 invalid api key provided</p>
  
  <p>I searched around stackoverflow and found a few stripe http post examples not using connect <a href="https://stackoverflow.com/questions/36953964/angular-and-stripe-cant-create-card-token-using-http-but-can-using-curl">Angular and Stripe, Can&#39;t create Card token using $http, but can using CURL</a>
  , I feel my error comes from formatting.</p>
  
  <p>Reading the curl documentation I know -F stands for "form" and -H is for "headers", -u is for "user", I've tried sending "user": "sk_test_key" outside of headers and inside data with no luck, same with file</p>