watson-developer-cloud / discovery-nodejs

This is a deprecated Watson Discovery Service Demo. A link to the newly supported demo is below
https://www.ibm.com/demos/live/watson-discovery/self-service
MIT License
76 stars 178 forks source link

Not Authorized error When searching in discovery-nodejs from localhost #82

Closed jdellaria closed 6 years ago

jdellaria commented 6 years ago

When following the instructions in the readme file to Run the demo locally I am I am getting a "Not Authorized" error.. I have created my discovery service and have all the associated password and logins in the .env file

screenshot 2017-11-14 13 41 46

pegomez commented 6 years ago

Good morning @jdellaria. Exactly the same the problem when I launched it for the first time. I strongly believe it is something related with the app.js file. Take a look at this part:

const discovery = new DiscoveryV1({ // If unspecified here, the DISCOVERY_USERNAME and // DISCOVERY_PASSWORD env properties will be checked // After that, the SDK will fall back to the bluemix-provided VCAP_SERVICES environment property username: 'XXXXXXXXXXX', password: 'YYYYYYYYYYY', version_date: '2017-11-07', });

Replace the XXX and YYY by your own credentials. It worked for me. Also, replace the .env.example file with your own data. It is Laravel related, but as I keep it updated it still work.

I hope your app is up and running soon. Best regards :-)

germanattanasio commented 6 years ago

As @pegomez said, you need to use your credentials in order to run the demo. See https://github.com/watson-developer-cloud/discovery-nodejs#setup-a-ibm-watson-discovery-service