Client Id, Client Secret and Redirect URL of a Nest Thermostat


#1

Hi Team,

I have been trying to create an android app through which I haveto control the Thermostat temperature. I took the android-sdk-sample and ran it. I have some queries on the client id, client secret etc…

  1. How can I get the client id, client secret of the Nest Thermostat? Be it created in a Home simulator or physical device.

  2. Do I need to create any product in developers.nest.com ? If so, what is this product? What is the relation between the Thermostat added in this product and the thermostat added in the Home Simulator?

I created a product by adding Thermostat in the developers site. When I ran the android app I logged in with the same email id, but I’m not coming back to the main activity after getting authorization code from the webpage which is in second activity.

Please help me in resolving the above said issues asap.I’m struck with these issues since last 2 days.

Thanks,
Krishna


#2

Hi @Krishna987,

Client ID and Client Secret are not related to Nest Thermostat and are created for you once you create your first product on developers.nest.com. While creating your product you will pick which functionality you want by picking permissions (i.e Thermostat control) and specify what your product does, it’s name, etc. After you are done with the product creation you will see your client id (otherwise called product id) and client secret (product secret) on the right side on the product page @developers.nest.com . After you use those in the SDK sample app code you will be able to go through an oauth flow with a Nest account (that you’re using for the simulator). After that you will be able to play with the sample app by adding thermostats in the simulator and observe the behavior of the SDK app.
More information on how to setup the oauth flow, etc can be found here.


#3

Thanks for the reply Luva.

I followed all the above steps which you explained.

Can you please explain what is Product here ?

I created a product ( I really don’t understand what is meant by product here , is it an interface through which we control the Nest devices ?) in developers.nest.com . I got client id , client secret and authorization url. I gave the client id , client secret and the redirected uri as “http://localhost/” . When I ran the android app it prompted me to accept the request. I accepted it then It showed some pin code and it still remains in the same screen. My expectation is it should return to the previous screen and tries to get the access code.

I had used the same login credentials in the Home Simulator and at the time of product creation. I hope this is correct.

My questions may be basic but I’m new to this Nest so please help me.


#4

Product here is a registered cloud integration with Nest. You can create an app (which will be a product) and let your users control their Nest devices or just see updates from their devices through your app (product) after they’ve authorized their Nest account by going through an oauth flow.
The pin code you’ve got is an authorization code that needs to be exchanged for an oauth token. Which will finish the authorization flow. There might be some issue with the redirect URI, since the code won’t get exchanged and instead shows up on your screen.


#5

I resolved this issue by giving http://localhost/ in the Redirect Uri field at the time of creating the product. Thanks Luva for your time.