jaetzold / philips-hue-java-sdk

An SDK for accessing a Philips Hue installation with Java / from the JVM. The aim is a simple and clean interface and no dependencies aside from Java 7 SE.
Other
12 stars 5 forks source link

cannot obtain authentication token #1

Open sabernar opened 11 years ago

sabernar commented 11 years ago

I'm using the demo code to connect to my Hue and it's failing to connect on

List<HueBridge> bridges = HueBridge.discover();

I'm getting the following error:

4-21 19:25:24.229: ERROR/HttpTransaction(21398): HttpOperation failed com.google.android.apps.plus.api.PostClientLogsOperation@421bda00 java.lang.RuntimeException: Cannot obtain authentication token at com.google.android.apps.plus.network.ApiaryHttpRequestConfiguration.addHeaders(ApiaryHttpRequestConfiguration.java:74) at com.google.android.apps.plus.network.HttpTransaction.(HttpTransaction.java:298) at com.google.android.apps.plus.network.HttpOperation.start(HttpOperation.java:202) at com.google.android.apps.plus.network.HttpOperation.start(HttpOperation.java:182) at com.google.android.apps.plus.network.HttpOperation$1.run(HttpOperation.java:297) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) at java.lang.Thread.run(Thread.java:856) Caused by: com.google.android.apps.plus.network.NetworkException: Cannot get auth token at com.google.android.apps.plus.util.AccountsUtil.getAuthToken(AccountsUtil.java:141) at com.google.android.apps.plus.api.ApiaryAuthDataFactory$ApiaryAuthDataImpl.getAuthToken(ApiaryAuthDataFactory.java:92) at com.google.android.apps.plus.network.ApiaryHttpRequestConfiguration.addHeaders(ApiaryHttpRequestConfiguration.java:71) ... 7 more Caused by: java.io.IOException at android.accounts.AccountManager.convertErrorToException(AccountManager.java:1619) at android.accounts.AccountManager.access$400(AccountManager.java:141) at android.accounts.AccountManager$AmsTask$Response.onError(AccountManager.java:1480) at android.accounts.IAccountManagerResponse$Stub.onTransact(IAccountManagerResponse.java:69) at android.os.Binder.execTransact(Binder.java:351) at dalvik.system.NativeStart.run(Native Method) 04-21 19:25:24.229: ERROR/EsService(21398): PostClientLogsOperation failed ex java.lang.RuntimeException: Cannot obtain authentication token errorCode 0 04-21 19:25:39.362: ERROR/GlsClient-query(936): requestFailed

jaetzold commented 11 years ago

Hmm, that's strange. It looks like you're using the code on an android device? I have not tested that. Does it work for you, when used outside of android? The problem is that the stack trace does not contain any information on where the call came from the hue-sdk.

Do you know what these android classes in the stacktrace are for? The exception talks about some auth token. But i have no idea what this could have to do with the UPnP discovery process that is started with HueBridge.discover(). Other than that both do networking, of course... :-)

lbromo commented 11 years ago

I tried to use this for an Android app aswell. It seems it is because the Android default wifi settings filters out any pakcet not specifik sent to the device. I might look some more into it in the following days, bur for now:

http://stackoverflow.com/questions/13221736/android-device-not-receiving-multicast-package http://developer.android.com/reference/android/net/wifi/WifiManager.MulticastLock.html