I am trying to send the proper request to Stripe to process my connect tokens, and I can't get it right.
This is the curl request they give as an example:
curl -X POST https://connect.stripe.com/oauth/token \
-d client_secret=sk_test_******************** \
-d code=AUTHORIZATION_CODE \
-d grant_type=authorization_code
This is my attempt with node-oath:
var OAuth2 = OAuth.OAuth2;
var client_id = 'ca_******************';
var secret = 'sk_test_*****************';
var oauth2 = new OAuth2(client_id,
secret,
'https://connect.stripe.com/',
null,
'oauth/token',
null);
oauth2.getOAuthAccessToken(
{'code':'ac_******************'},
{'grant_type':'authorization_code'},
function (e, access_token, refresh_token, results){
console.log('bearer: ',e);
});
I am able to get a response but it is always:
{ statusCode: 400,
data: '{\n "error": "invalid_grant",\n "error_description": "Authorization code does not exist: "\n}' }
I know my keys are right, I just think I am putting them in the wrong places. There is almost no documentation on the node-oauth module so I'm not sure what the arguments are supposed to be.