Unable to find the credentials file on the linux machine


#1

I have followed the instructions on the website for download of plotly for node.js. However I have issues in the authentication step, and am unable to find the credentials file to insert the API key. Could someone kindly help me in this regards?
Thanks a lot.


#2

The node.js API doesn’t come with a credentials file. You have to fill in your own e.g.

echo '{ "username": "bob", "apiKey": "adsad" }' > credentials.json

#3

Created the json file as well. However, on firing up node on the terminal, the output continues to be:
Code: var plotly = require(‘plotly’)(“ahana204”, “xzvdotRTClsNR8NdpBsN”)
Output: undefined


#4

I’m not sure how to help you here.

The node.js API does not look for a credentials file upon var plotly = require('plotly') - unlike our “higher-level” APIs such as plotly.py and R plotly. So once you filled in your credentials file, you’ll have to do something like:

var creds = require(/* /path/to/credentials.json */)
var plotly = require('plotly')(creds.username, creds.apiKey)

// ...

#5

did you ever solve this? i have the same issue


#6

I switched to using D3JS for charting instead. Plotly for NodeJs didn’t have the best functionality for charts.