Forum Academy Marketplace Showcase Pricing Features

Trouble initializing API call

Hi all,

New to Bubble and I’ve got to say I’m impressed with it’s capabilities and community engagement.

I’m having trouble getting the Coinbase Pro API (Coinbase Pro | API Reference) initialized.

When I try and initialize I get the following error:
“Raw response for the API
Status code 401
{“message”:“invalid signature”}”

I’ve set the API call up as such:

I’m manually creating the signature for CB-ACCESS-SIGN using the code in the docs:
var crypto = require(“crypto”);

var secret =

“thsxMOn1m1ythJ4HMSHIeKtetgc+VPj6cSD5UQ8tH7d8W211BsG9mVT9HSyF1RK7ZlxWUnnhzKagna7qqgnIeA==”;

var timestamp = 1624297400;
var requestPath = "/payment-methods";

var body;

var method = "GET";

// create the prehash string by concatenating required parts
var what = timestamp + method + requestPath + body;

// decode the base64 secret
var key = Buffer.from(secret, "base64");

// create a sha256 hmac with the secret
var hmac = crypto.createHmac("sha256", key);

 // sign the require message with the hmac
// and finally base64 encode the result
console.log(hmac.update(what).digest("base64"));

@Kfawcett I saw you were building out using the Coinbase Pro API in 2018. Any ideas in the issue?

@jarrad You had some great input when Keith was having an issue with the base 64 decoding - I’m planning on using your plug in when I get it initialized. Any thoughts on the initialization issue?

** All the secret, key and passphrase are from a Sandbox environment.

I’m not sure of the error and I don’t know this API. But actually, the body is “null/undefined” and not ‘’
try var body = ‘’

1 Like

Hey @Jici,

Thanks for the fast response. Your solution worked and the call initialized.

I read on a forum somewhere it was meant to be set up as:
var body;
rather than
var body = “”;

It’s depend of each API request. Found a different example here: API Key Authentication - Coinbase Developers
That clearly how to set the body for the GET request :wink: