GoCardless API: Can't send secret_key & secret_id

Been trying to connect GoCardess’s bank accounts but cannot get it to work despite the postman working and API call working itself.

Postman

The issue is specifically calling this:

curl -X POST "https://bankaccountdata.gocardless.com/api/v2/token/new/" \
  -H "accept: application/json" \
  -H  "Content-Type: application/json" \
  -d "{\"secret_id\":\"88674960-6cf0b59a84\", \"secret_key\":\"c06dc9be3bbd5b920593d366f728ab61716026e3815cdba69bcaf485d57de0f8bbd166fef235910ff02c411c430287f6e555537b8\"}"

and the error ends up being:
* Raw response for the API Status code 400 {"secret_id":["This field is required."],"secret_key":["This field is required."],"status_code":400}

So it looks like the secret_id and secret_key are not getting passed.

This is configured as a JSON body type.

If you try and just have the same JSON and use this link: https://bankaccountdata.gocardless.com/api/v2/token/new it will work (well it won’t because the key’s content is edited, but the keys are sent through)

The docs are the following: Bank Account Data - Quickstart Guide

bubble is just not sending through the keys… any ideas?

Toby

Can sou share api connector settings? Did you add content type header?

yup all that is setup.

Content-Type: application/json

Checked for spelling, etc.

It triggers, just the JSON doens’t get sent.

T.

But how did you set the json? Please share a screenshot.

If you copied and paste the escaped JSON… this is why it’s not working probably

{
  "secret_id": "yoursecretid",
  "secret_key": "yoursecretkey"
}

By the way, this kind of auth can be used in custom oauth2 token.

This is the setup:

Working for me:

Any shared header that could create issue?

What did you use for the header? This is super weird…

I tried with this:

With the JSON being the same as you…

T

I didn’t add any because bubble by default add one. And for Accept, doesn’T seem to be really mandatory.

Well whatever you did is magic… cause I can’t see how it works…

Start from scratch with a new API and call. In some rare case, Call get corrupted by attempt you did.

yup did that - one a new project + even a new plugin… :confused:

Always the same error?

That sound very strange…

Yup same thing. Just a 400 the Jain isn’t being seen.

If I use oauth2 custom token I get that the secret_key is wrong… but it’s correct… soo that doesn’t help.

T

I’ve checked and finally doesn’t think it will work for custom token because this is not returning the token_type parameter and doesn’t response with access_token but just “access” instead. Sorry.

Next step to debug this is to create a requestbin.com (or other similar tool) and send the request there and inspect

Found it:
Importing the cURL will trim the trailing /

This means that the call wasn’t working correctly, and pointing to the wrong API. Needed /new/ instead of /new

Thanks bubble! grrr