Android SDK, cant reach username/password landing page when authenticating using client_id/secret/redirect URL


#1

An issue occures when trying to use the nest sdk for android on some of my android devices. (on other devices it goes through.

Using the Android SDK Version 1.1.1, Im running the sample code provided by nest, to call the function:
nest.launchAuthFlow(this, AUTH_TOKEN_REQUEST_CODE); (after nest.setConfig(xxx,xxx,xxx); is set)
Once this webview page appears, it gets stuck on the spinner, and does not load the sign up page.

The important logs that should be mentioned are from chromium:

06-26 11:48:58.258 23854-23854/com.videri.nestapitest I/chromium: [INFO:library_loader_hooks.cc(120)] Chromium logging enabled: level = 0, default verbosity = 0
06-26 11:48:58.343 23854-23854/com.videri.nestapitest W/chromium: [WARNING:resource_bundle.cc(285)] locale_file_path.empty()
06-26 11:48:58.731 23854-23904/com.videri.nestapitest W/chromium: [WARNING:data_reduction_proxy_config.cc(423)] SPDY proxy OFF at startup
06-26 11:49:00.962 23854-23854/com.videri.nestapitest I/chromium: [INFO:CONSOLE(1558)] “Login v%s”, source: https://home.nest.com/login/assets/vendor-deb882192b9ec010c14520b42f2456ea.js (1558)
06-26 11:49:01.071 23854-23854/com.videri.nestapitest I/chromium: [INFO:CONSOLE(1560)] “Error while processing route: oauth2.index”, source: https://home.nest.com/login/assets/vendor-deb882192b9ec010c14520b42f2456ea.js (1560)

Please let me know what i can do to fix this, if i need a different firmware to get it to work, or if it is something that needs to be done on nest SDK side. thanks.


#2

Hi, can you you find out which Android versions you have for devices that are working vs. not working?
Thanks


#3

Hey Becky, so I’ve ran the very basic sample code provided and also created my own standalone APK using the Nest SDK and code snippet provided to just reach the landing page to input username/password on the following devices:
Samsung galaxy s8 - worked ( API 26)
Nexus 7 tablet - worked (API 21)
Nexus 7 tablet - worked (API 23)
emulator Android Accelerated Nougat - worked (API 25)
emulator Nexus 6 - didnt work (API 23)
emulator Nexus 5 AOSP - didnt work (API 23)

Thanks again.


#4

HI ayalus, thanks for the details on this. We’ll see if we can reproduce it and find the cause of the error.


#5

Thank you Becky. Waiting on your input.


#6

Hey Becky, any input on this bug yet?


#7

Hi ayalus,
I can reproduce the error you get with this emulator (emulator Nexus 6 API 23). The Nest android-sdk is built for version 25 so it may be an issue for running emulators below this level.
https://github.com/nestlabs/android-sdk/blob/master/sdk/build.gradle:

compileSdkVersion 25
buildToolsVersion “25.0.3”

Have you tried to run it on a device at level 23 or 24?
Thanks


#8

Hey Becky,
So Ive tested it on multiple API 23 devices:
Real Nexus 7 tablet WITH google play - WORKED (API 21)
Real Nexus 7 tablet WITH google play - WORKED (API 23)
Emulator Nexus 7 tablet WITH google play - DIDNT WORK (API 23)
Emulator Nexus 7 tablet WITHOUT google play - DIDNT WORK (API 23)
Emulator Nexus 7 tablet WITH google play - WORKED (API 25)

I saw that for some features in Nest API, the min requirement is API 25, but I dont think its a API restriction for the login, as it works on the nexus 7 tablet (API 23). Could there be a dependency on google play services? it worked in the past with versions under API 25 without google play, and then just stopped working on those devices out of the blue.


#9

Hi ayalus, thanks for your patience.
Are you seeing these errors?
E/SysUtils: ApplicationContext is null in ApplicationStatus
No DRP key due to exception:java.lang.ClassNotFoundException: com.android.webview.chromium.Drp

Also do you know when this emulator stopped working?


#10

Hey Becky,

When I run the APK on the emulator, these are the logs regarding chromium:

nestservicesdemo V/WebViewChromiumFactoryProvider: Binding Chromium to main looper Looper (main, tid 1) {2cc5882}
nestservicesdemo I/chromium: [INFO:library_loader_hooks.cc(120)] Chromium logging enabled: level = 0, default verbosity = 0
nestservicesdemo I/BrowserStartupController: Initializing chromium process, singleProcess=true
nestservicesdemo W/chromium: [WARNING:resource_bundle.cc(285)] locale_file_path.empty()
nestservicesdemo E/DataReductionProxySettingListener: No DRP key due to exception:java.lang.ClassNotFoundException: com.android.webview.chromium.Drp
nestservicesdemo W/chromium: [WARNING:data_reduction_proxy_config.cc(423)] SPDY proxy OFF at startup
nestservicesdemo I/chromium: [INFO:CONSOLE(1558)] “Login v%s”, source: https://home.nest.com/login/assets/vendor-deb882192b9ec010c14520b42f2456ea.js (1558)
nestservicesdemo I/chromium: [INFO:CONSOLE(1560)] “Error while processing route: oauth2.index”, source: https://home.nest.com/login/assets/vendor-deb882192b9ec010c14520b42f2456ea.js (1560)

I also run the APK on a custom device and get these errors:

nestservicesdemo E/Web Console: Uncaught ReferenceError: WeakMap is not defined at https://home.nest.com/login/assets/vendor-deb882192b9ec010c14520b42f2456ea.js:2181
nestservicesdemo E/Web Console: Uncaught Error: Could not find module ember-load-initializers imported from login/app at https://home.nest.com/login/assets/vendor-deb882192b9ec010c14520b42f2456ea.js:12

Im unaware of when it stopped working on the emulator. i know it stopped working on our unit at least a few months ago.

Thank you and your team as well for working with me on figuring this out.


#11

Hi ayalus,
I am getting similar errors for API level 23 also.
I was able to run the sample code on API level 24. I don’t get any ClassNotFoundException errors at this level or above, so that may be the cause for API level 23. It may be from an Android studio upgrade but I’ll update this thread if I can find out anything more on this.


#12

The APK running the nest sample code was running on a device with API level 18, and it worked for over a year. Without changing the APK, the nest authentication process stopped working, so something def changed on your end. Please keep me posted on findings and i can try testing them on my end.


#13

Hey Becky,

Just wanted to touch base one last time before I move on from this issue. Is there anything else that can be done on your end? or have we reached the end of the line?

Thanks for all of your time spent on trying to make this work,

Ayal


#14

Hi Ayal,

I would like to find out and let you know, and the APK information you sent is helpful. I don’t have an estimate but will see what we can find out about any change to the Nest application and how these earlier emulators may respond to the change, if that is a possible cause.
Maybe other developers are having the same issues so I think it’s helpful to keep looking into.

Thanks,
Becky


#15

Hey Becky,

After robust testing, I found that the issue is related to the webview rendered by our device’s ROM. Once we updated the System WebView implementation on one of our devices, it started working again (older devices running 4.3 are still not working). If you run the Nest SDK on a WebKit-based WebView, in other words, anything below 4.4 KitKat, the Nest login page will fail to render. Therefore, it will fail on an AOSP device, unless its underlying WebView is updated at the OS level, or currently on a WebKit WebView as in the case of pre-4.4 Android. That’s something to consider going forward: whether there’s a way to make it work on non-Chromium WebViews, since you support at the very least Android 4.1.1 Jelly Bean.


#16

Hi Ayal,

That’s great you got it working, and the updates on this is much appreciated. I will see if we can add some notes to the sample.

Thanks,
Becky