coinbase API 问题

coinbase API issue

我正在尝试使用节点 v12.16.3 连接到 Coinbase API:

var express = require('express');
var router = express.Router();
var Client = require('coinbase').Client;
....
router.get('/', function(req, res, next) {
var client = new Client({
    apiKey: 'my_apiKey',
    apiSecret: 'my_apiSecret'
  });
  client.getCurrencies(function(err, currencies) {
    console.log(' *************** Crypto Currencies *************** ');
    console.log(currencies);
    console.log(err);
  });
);

但不幸的是我收到了这个错误:

Error: unable to get local issuer certificate
    at TLSSocket.onConnectSecure (_tls_wrap.js:1474:34)
    at TLSSocket.emit (events.js:310:20)
    at TLSSocket._finishInit (_tls_wrap.js:917:8)
    at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:687:12) {
  code: 'UNABLE_TO_GET_ISSUER_CERT_LOCALLY'
}

已经尝试 运行 : npm config set strict-ssl falsenpm config set registry http://registry.npmjs.org/ 但它不起作用。你可以帮帮我吗? 非常感谢。

检查您是否有权访问 https://api.pro.coinbase.com and https://api-public.sandbox.pro.coinbase.com

否则,您的 router/admin/provider 可能会在防火墙中阻止此站点,您将无法访问它。

顺便说一句。包 coinbase 已弃用,最好使用 coinbase-pro-node