Search code examples
nest-api

Nest Javascript Thermostat sample not working - 400 Bad Request


I've built the sample app from here: https://developer.nest.com/documentation/cloud/control/

I've created a Client configuration on the developer site with the callback url http://localhost:8080.

The app loads and brings you to the Nest login screen. After entering details it should redirect back but instead the URL https://home.nest.com/session fails with a 400 Bad Request and the response:

{"error":"invalid_request","error_description":"missing user credentials"}

Has anyone got this sample working lately? I believe it's failing in the server.js file at this line (but I'm no Node expert unfortunately):

app.get('/auth/nest', passport.authenticate('nest'));

I've replaced the firebase.js file with the version from the Nest site. Could this be a bug in a recent version of Express or the Nest Passport library?

Tried on OSX, Linux and Windows and getting the same issue.

Thanks!


Solution

  • The OAuth Redirect URI in your client for this example should be http://localhost:8080/auth/nest/callback and be sure that your permissions are set for Thermostat read/write.