michielpost / Q42.HueApi

C# helper library to talk to the Philips Hue bridge
MIT License
409 stars 114 forks source link

RemoteHueClient.Authorize() gives back HTML #73

Closed niels9001 closed 7 years ago

niels9001 commented 8 years ago

User needs to log into the Hue account and authorize the app to control the lights remotely.

This call does not give back JSON, but gives back HTML from the login page. Q42.HueApi.RemoteHueClient cl = new RemoteHueClient(null); string asd = await cl.Authorize("ID", "asdasd", "MyPC", "APPID", "ThisPC", "code");

My guess is that the following should work: `string URL = string.Format("https://api.meethue.com/oauth2/auth?clientid=ID&response_type=code&state=asdasd&appid=APPID&deviceid=MyPC&devicename=ThisPC");

System.Uri startURI = new System.Uri(URL); System.Uri endURI= new System.Uri(OtherURL);

var webAuthenticationResult = await WebAuthenticationBroker.AuthenticateAsync(WebAuthenticationOptions.None, startURI, endURI);' image

michielpost commented 8 years ago

Thanks for the feedback. I understand this method should popup a browser so the user can authenticate with it's Hue account. Not sure if this should be part of Q2.HueApi or that you should just implement it yourself because it can be App specific how to show this login screen.

I currently don't have access to the remote API, so unable to test. I'm going to request access again.

Can you make a pull request with code that works for you?

michielpost commented 7 years ago

This has been fixed in the new 3.1.0 release. https://github.com/Q42/Q42.HueApi/releases/tag/3.1.0

There's now also a sample app that works with the Remote API.