Firebase API port


#1

Working on Nest API integration using OAuth approach. We are in the secured zone and seeing issues while calling https://developer-api.nest.com as it is being redirected to firebase-api… urls. We need to open IPs in firewall to get the connection open, can we have the safe bet if we open everything on port 9553 so that firebase requests can also get served?

Please help. Thanks


#2

Yes, you will need to open port 9553 in order for Firebase requests to the Nest API to work.


#3

Thanks will open 9553 port


#4

Can we do a reverse proxy through webserver as we don’t want to open our app server to the internet. If we want to do the reverse proxy can you please give us the pattern of the redirect URL returned in order to intercept and pass it to our app server?


#5

Sure, you should be able to see the pattern of the redirect URLs by checking the content of the 307 redirect you receive when calling the Nest API. More info here: https://developers.nest.com/documentation/cloud/how-to-handle-redirects


#6

Hi We are getting following exception on the returning firebase URL

[12/6/17 17:06:59:900 CST] 000000c8 SystemOut O 2017-12-06 17:06:59,900 INFO [WebContainer : 1] service.NestRestService (NestRestService.java:54) - NestRestService.getThermostatData ------Start
[12/6/17 17:06:59:901 CST] 000000c8 SystemOut O 2017-12-06 17:06:59,901 INFO [WebContainer : 1] service.NestRestService (NestRestService.java:55) - Nest API url : https://developer-api.nest.com/nest
[12/6/17 17:07:00:081 CST] 000000c8 SystemOut O 2017-12-06 17:07:00,080 INFO [WebContainer : 1] service.NestRestService (NestRestService.java:63) - response is not null : <307 Temporary Redirect,{Content-Type=[application/json; charset=UTF-8], Access-Control-Allow-Origin=[], Cache-Control=[private, no-cache, no-store, max-age=0], Pragma=[no-cache], Location=[https://firebase-apiserver06-tah01-iad01.dapi.production.nest.com:9553/nest], Connection=[close], Authorization=[Bearer c.sLwlccmNK91NK53bu0CKNJlfJopNOaRKx7FlQaPnRJL2yKe98OyUF73uA7mwAkileFzAD8nZqueCo9mtsAHeqd5FVELyj5DMJ744RGh5R9M1Ce6R2v1XKuKR1PRQlrXkgESBydvwNY2OPrrR], content-length=[0]}>
[12/6/17 17:07:00:082 CST] 000000c8 SystemOut O 2017-12-06 17:07:00,081 INFO [WebContainer : 1] service.NestRestService (NestRestService.java:64) - response headers : {Content-Type=[application/json; charset=UTF-8], Access-Control-Allow-Origin=[
], Cache-Control=[private, no-cache, no-store, max-age=0], Pragma=[no-cache], Location=[https://firebase-apiserver06-tah01-iad01.dapi.production.nest.com:9553/nest], Connection=[close], Authorization=[Bearer c.sLwlccmNK91NK53bu0CKNJlfJopNOaRKx7FlQaPnRJL2yKe98OyUF73uA7mwAkileFzAD8nZqueCo9mtsAHeqd5FVELyj5DMJ744RGh5R9M1Ce6R2v1XKuKR1PRQlrXkgESBydvwNY2OPrrR], content-length=[0]}
[12/6/17 17:07:00:082 CST] 000000c8 SystemOut O 2017-12-06 17:07:00,082 INFO [WebContainer : 1] service.NestRestService (NestRestService.java:65) - response status code is : 307
[12/6/17 17:07:00:083 CST] 000000c8 SystemOut O 2017-12-06 17:07:00,083 INFO [WebContainer : 1] service.NestRestService (NestRestService.java:71) - Redirect Location is : https://firebase-apiserver06-tah01-iad01.dapi.production.nest.com:9553/nest and the count is 0
[12/6/17 17:07:00:389 CST] 000000c8 SystemErr R org.springframework.web.client.HttpClientErrorException: 404 Not Found
[12/6/17 17:07:00:390 CST] 000000c8 SystemErr R at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:91)
[12/6/17 17:07:00:390 CST] 000000c8 SystemErr R at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:700)
[12/6/17 17:07:00:390 CST] 000000c8 SystemErr R at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:653)
[12/6/17 17:07:00:390 CST] 000000c8 SystemErr R at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:628)
[12/6/17 17:07:00:390 CST] 000000c8 SystemErr R at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:549)
[12/6/17 17:07:00:390 CST] 000000c8 SystemErr R at com.nrg.oneapp.service.NestRestService.getThermostatData(NestRestService.java:72)
[12/6/17 17:07:00:390 CST] 000000c8 SystemErr R at com.nrg.oneapp.helper.NestHelper.getThermostatData(NestHelper.java:27)
[12/6/17 17:07:00:390 CST] 000000c8 SystemErr R at com.nrg.oneapp.controller.NestRestController.getThermostatData(NestRestController.java:42)
[12/6/17 17:07:00:390 CST] 000000c8 SystemErr R at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)


#7

Post Man Response Image


#8

Looks like your original call is to https://developer-api.nest.com/nest, which is not a valid endpoint in the API. Try it without the /nest at the end.


#9

Thanks. I overlooked it.


#10

Is there any port range for firebase? Or 9553 is fixed?

Thanks