{"action":"created","issue":{"url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-datastore/issues/55","repository_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-datastore","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-datastore/issues/55/labels{/name}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-datastore/issues/55/comments","events_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-datastore/issues/55/events","html_url":"https://github.com/GoogleCloudPlatform/google-cloud-datastore/issues/55","id":50317377,"number":55,"title":"New Code For Node.js Sample Needed","user":{"login":"anywhichway","id":4958795,"avatar_url":"https://avatars.githubusercontent.com/u/4958795?v=3","gravatar_id":"","url":"https://api.github.com/users/anywhichway","html_url":"https://github.com/anywhichway","followers_url":"https://api.github.com/users/anywhichway/followers","following_url":"https://api.github.com/users/anywhichway/following{/other_user}","gists_url":"https://api.github.com/users/anywhichway/gists{/gist_id}","starred_url":"https://api.github.com/users/anywhichway/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anywhichway/subscriptions","organizations_url":"https://api.github.com/users/anywhichway/orgs","repos_url":"https://api.github.com/users/anywhichway/repos","events_url":"https://api.github.com/users/anywhichway/events{/privacy}","received_events_url":"https://api.github.com/users/anywhichway/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2014-11-27T18:52:18Z","updated_at":"2016-04-06T20:22:28Z","closed_at":"2016-04-06T20:22:28Z","body":"The existing code for the node.js example is both complex and broken. It won't work with the most recent googleapis version. Below is code that is simple and will connect and authenticate. Querying is another issue, see open bug on this:\r\n\r\n'var util = require('util');\r\nvar google = require(\"googleapis\");\r\nvar SCOPES = ['https://www.googleapis.com/auth/userinfo.email',\r\n              'https://www.googleapis.com/auth/datastore'];\r\nvar datasetId = \"<your-dataset-id>\";\r\ncredentials = new google.auth.JWT(\r\n        process.env['DATASTORE_SERVICE_ACCOUNT'],\r\n        process.env['DATASTORE_PRIVATE_KEY_FILE'],\r\n        null,\r\n        SCOPES);\r\ncredentials.authorize((function(jwtErr) {\r\n  if (jwtErr) {\r\n    errors = {'jwt auth error':jwtErr};\r\n    console.log(errors);\r\n    return;\r\n  }\r\n  var cloudstore = google.datastore('v1beta2').datasets;\r\n\r\n<your code and queries here using the cloudstore variable>'"},"comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-datastore/issues/comments/206543163","html_url":"https://github.com/GoogleCloudPlatform/google-cloud-datastore/issues/55#issuecomment-206543163","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-datastore/issues/55","id":206543163,"user":{"login":"eddavisson","id":2954278,"avatar_url":"https://avatars.githubusercontent.com/u/2954278?v=3","gravatar_id":"","url":"https://api.github.com/users/eddavisson","html_url":"https://github.com/eddavisson","followers_url":"https://api.github.com/users/eddavisson/followers","following_url":"https://api.github.com/users/eddavisson/following{/other_user}","gists_url":"https://api.github.com/users/eddavisson/gists{/gist_id}","starred_url":"https://api.github.com/users/eddavisson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eddavisson/subscriptions","organizations_url":"https://api.github.com/users/eddavisson/orgs","repos_url":"https://api.github.com/users/eddavisson/repos","events_url":"https://api.github.com/users/eddavisson/events{/privacy}","received_events_url":"https://api.github.com/users/eddavisson/received_events","type":"User","site_admin":false},"created_at":"2016-04-06T20:22:28Z","updated_at":"2016-04-06T20:22:28Z","body":"Closing since we've removed the Node.js sample from the repo.\r\n\r\nCheck out [gcloud-node](https://github.com/GoogleCloudPlatform/gcloud-node#google-cloud-datastore) as an option for accessing Google Cloud Datastore from Node."}}