auth0-samples / auth0-react-sample

130 stars 149 forks source link

adding 08-Calling-Api sample #10

Closed flaviogranero closed 8 years ago

flaviogranero commented 8 years ago

@alemata take a look, please

alemata commented 8 years ago

👍 @ntotten @chenkie

flaviogranero commented 8 years ago

@mpaktiti this is ready but please merge #8 first

chenkie commented 8 years ago

Running into some errors with this one:

buffer.js:140
    throw new TypeError('must start with number, buffer, array or string');
    ^

TypeError: must start with number, buffer, array or string
    at fromObject (buffer.js:140:11)
    at new Buffer (buffer.js:62:10)
    at Object.<anonymous> (/Users/ryanchenkie/Desktop/code/auth0-react-sample/08-Calling-Api/server.js:7:11)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Function.Module.runMain (module.js:441:10)
    at startup (node.js:139:18)
    at node.js:968:3

It will start but that error is there. Then when trying to call the API, I get:

[HPM] PROXY ERROR: ECONNREFUSED. localhost -> http://localhost:3001/api/public
flaviogranero commented 8 years ago

@chenkie the error is raising because you don't have a .env file with the required auth0 values. I updated the server to show a clear message about the issue, also updated the script to fail the start up. It's ready for a new review.

chenkie commented 8 years ago

Thanks, that will be helpful. Some people may forget to change the .env file even though it's in the readme :)