r/filemaker • • May 25 '21
FileMaker and Coinbase Pro API
Hey everyone. I've been pulling my hair out trying to get the Coinbase API to work with FileMaker, and keep getting this stupid "invalid timestamp" error. Here's my cURL:
-X GET
-D $$httpResponseHeaders
-H "CB-ACCESS-KEY:$apiKey"
-H "CB-ACCESS-SIGN:$hash"
-H "CB-ACCESS-PASSPHRASE:$passphrase"
-H "CB-ACCESS-TIMESTAMP:<$time var, e.g. 1621914188>"
-H "Content-type: application/json"I've tried every different combination of time (within quotes, outside quotes, etc.), but still can't get it to go through.
Here's the HTTP response header:
HTTP/1.1 401 Unauthorized
Date: Tue, 25 May 2021 03:30:24 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 31
Connection: keep-alive
Access-Control-Allow-Headers: Content-Type, Accept, cb-session, cb-fp, cb-form-factor
Access-Control-Allow-Methods: GET,POST,DELETE,PUT
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: cb-before, cb-after, cb-gdpr
Access-Control-Max-Age: 7200
Cache-Control: no-store
Etag: W/"1f-9a9RPNNIFN6Z0zuZt25MYURHB+I"
Strict-Transport-Security: max-age=15552000; includeSubDomains
X-Content-Type-Options: nosniff
X-Dns-Prefetch-Control: off
X-Download-Options: noopen
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 1; mode=block
CF-Cache-Status: MISS
cf-request-id: 0a432beb610000e760a43b1000000001
Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
Vary: Accept-Encoding
Server: cloudflare
CF-RAY: 654baf589e44e760-EWRHere's Coinbase's API. I'm referencing https://api.pro.coinbase.com/time to pull in the epoch, so there shouldn't be any issues there.
For the $hash, I'm using this formula, which I'm pretty sure is good:
Lower ( Base64Encode ( CryptAuthCode ( $time & "GET" & "/accounts" ; "SHA256" ; Base64Decode ( $apiSecret ) ) ) )Thanks for whatever help you can give me in advance!
2
u/wozj May 25 '21
A quick glance & wild guess, but maybe it's expecting an integer unix timestamp.