{"id":16793527,"url":"https://github.com/mdp/ncoinbase","last_synced_at":"2025-10-04T22:47:20.372Z","repository":{"id":66279403,"uuid":"13376400","full_name":"mdp/NCoinbase","owner":"mdp","description":"NodeJS library to interface with Coinbase via OAuth 2.0","archived":false,"fork":false,"pushed_at":"2013-10-09T05:23:28.000Z","size":124,"stargazers_count":3,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-04T18:38:32.419Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mdp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-10-07T06:14:41.000Z","updated_at":"2017-02-10T02:09:18.000Z","dependencies_parsed_at":"2023-02-20T01:30:38.859Z","dependency_job_id":null,"html_url":"https://github.com/mdp/NCoinbase","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mdp/NCoinbase","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdp%2FNCoinbase","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdp%2FNCoinbase/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdp%2FNCoinbase/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdp%2FNCoinbase/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mdp","download_url":"https://codeload.github.com/mdp/NCoinbase/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdp%2FNCoinbase/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278386121,"owners_count":25978109,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-04T02:00:05.491Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T08:49:33.216Z","updated_at":"2025-10-04T22:47:20.355Z","avatar_url":"https://github.com/mdp.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NCoinbase\nAn OAuth2 compliant NodeJS Coinbase API library\n\n[![Build Status](https://secure.travis-ci.org/mdp/NCoinbase.png)](http://travis-ci.org/mdp/NCoinbase)\n\n## Quick Overview\n\n- Implements all the v1 API methods\n- Every API method allows callbacks or returns promises\n- Automatically refreshes expired tokens (and fires an event)\n\n## Installation\n\n    npm install ncoinbase\n\n## Usage\n\n### Setting up the client\n\n    var Coinbase = require('ncoinbase').Coinbase,\n        api = new Coinbase({\n          \"id\": \"api_id\",\n          \"secret\": \"api_secret\",\n          \"redirect_uri\": \"http://localhost:4000/callback\",\n          \"scope\": \"balance request\"\n        });\n\n### Creating and API consumer (user)\n\n    // Assuming we pulled the users credentials\n    // from the database and assigned them to 'user'\n    credentials = new Credentials(user);\n    consumer = api.createConsumer(credentials);\n\n### Accessing the API\n\n    req.coinbase.account_balance(function (err, resp) {\n      console.log(\"My Account balance is: \" + resp.amount );\n    });\n\n#### Using Promises\n\n    req.coinbase.account_balance()\n      .then(function (resp) {\n        console.log(\"Resp\", resp);\n        res.send(resp);\n      })\n      .catch(function (err) {\n        console.log(\"Err\", err);\n        res.send(\"API Request failed: \" + err.message);\n      });\n\n#### Refreshing expired tokens\n\nExpired tokens will be automatically refreshed when you attempt an API call.\nYou can, and should, listen for this for the 'updatedCredentials' event and\nsave the new credentials.\n\n    consumer.on('updatedCredentials', function (credentials) {\n      user.credentials = credentials;\n      user.save();\n    });\n    // Let's assume the users credentials are expired\n    // and we need to use the refresh token.\n    consumer.account_balance(function (err, resp) {\n      // This will still work, but before the 'account_balance'\n      // request is made, the credentials will be refreshed,\n      // and the 'updatedCredentials' event will be fired.\n      console.log(\"I have \" + resp.amount + \" many bitcoins!!!\");\n    });\n\n## Example web application\n\n### Clone the repo and 'npm install'\n\n    git clone https://github.com/mdp/NCoinbase.git\n    cd NCoinbase\n    npm install\n\n    node example/server.js\n\n### Authenticate with Coinbase\n\nNow visit [http://localhost:4000](http://localhost:4000) to authenticate\n\n### Exercise the API\n\nAfter authenticating you should see your account details on the index page.\nYou can also try [http://localhost:4000/my_balance](http://localhost:4000/my_balance)\nfor your account balance.\n\n### The nitty gritty\n\nThe example app show several library features\n\n- Watching for expired/refreshed credentials and updating the session [example/server.js#L27](mdp/NCoinbase/blob/master/example/server.js#L27)\n- Using promises with an error catch [example/server.js#L49](mdp/NCoinbase/blob/master/example/server.js#L49)\n- Passing in a callback function [example/server.js#L61](mdp/NCoinbase/blob/master/example/server.js#L61)\n\n## Testing\n\n    git clone https://github.com/mdp/NCoinbase.git\n    cd NCoinbase\n    npm install\n    npm test\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdp%2Fncoinbase","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmdp%2Fncoinbase","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdp%2Fncoinbase/lists"}