New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
demo not working ? [flutter_hue] #9
Comments
edit : apparently it does work but one time on 5-6 tries, |
The This is used on Philips Hue's side when the user tells Hue that your app has permission to log into their account. Once they log in and approve your app, Philips Hue redirects them to the redirect URI from your dev console; your app will capture that redirect with deep linking and open your app. Does this help at all? |
Yes, but the url I provided isn't valid ? I think it is with sheme being https, correct me if I'm wrong, my question was mostly related to the errors I got ! |
What is the URL you provided? Is that a Postman testing environment? Or is that what you would use in your final product? Also, what are you trying to get your app to do right now? Are you trying to establish a remote connection (your phone not on the same network as your Philips Hue device) or a local connection (everything on the same wifi)? |
https://oauth.pstmn.io/v1/browser-callback |
Are you familiar with deep linking? I'm not sure Postman is the right thing to use in this situation. |
My goal is to control my lights, |
When you run your example with latest flutter sdk and android version is it working for you? |
Yes, it is working for me. Is your app running on a device that is on the same network as your Philips Hue bridge? |
Not really, If you have any ressource to link maybe it could help, thanks :) |
Here is a link for deep linking in general This is a link for setting up a remote connection with this SDK. The SDK should handle the deep linking for you |
Yes the bridge with ethernet and my phone on wifi, I will do more testing tomorrow thanks for the docs |
okay so I tried with a new redirect uri, I updated it in hue's dev console, this is my app id : com.example.jdr_ia I can detect my bridge with "discover bridges" button,
|
I have published a new version (1.2.1) that should fix the above issue. You are testing my code with Philips Hue devices that I don't have. You may run into other bugs like this that I missed because I just never came across them in testing. Please let me know about them so I can get them fixed.
This issue could be a number of things. The first thing I would do is stop your app emulation, run If that doesn't work, it could be the underscore in your URL scheme. It should work, but some people warn of odd behavior with special characters. Try these ideas, and come back to me if it still isn't working. I'm happy to help! |
Thank you for your time and quick response ! The 1.2.1 fixed the fetchNetwork, now I can control the lamps locally ! I updated my scheme, which is now correctly redirecting to my app, it was probably an underscore issue. I still have 2 issues :
I checked that with prints/breakpoint that never got triggered, it should after the redirect ? Or am I wrong ? |
Once a bridge has been connected to, it will not show up again when discovering bridges. To find bridges that you have already connected to, use I'm not sure why |
okay for the stream.listen() I created a minimal example based on your example here |
I don't see why it wouldn't be working for you. A few questions:
|
|
After a lot of experimenting, I believe this line is causing your
It is the second line in your Android manifest. Remove that line entirely, and run |
I tried removing the line from manifest, does it work for you ? on what device ? |
It works for me on all devices. If you just do a local connection, are you able to control the lights? Can you try remote connection again, and give me the whole console printout? |
Locally yes, everything works as expected, I can use all the features showcased in the demo. sure, here is the console output |
I don't see anything obvious to me. I do see this error:
That could have something to do with it. Also, it is possible some other package is intercepting your incoming deep link. If you are plugging the Flutter Hue SDK into your app that has lots of other code and packages, the best thing to do is work on a separate app that is just like the example app. Then, if you can get that working, add more to it until you find out what breaks it. |
I think this error might be because I tried to call fetchSavedBridges on a fresh install so there was no bridge saved... To be 100 % sure it's not related to others packages i'm still using this repo to make my tests |
Do you have the official philips hue app or does the redirect opens your web browser ? |
The redirect should open in your browser. |
Okay so I just tried to uninstall the philips hue app and it seems that it was because of it. It is still problematic tho, because most of philips hue users have the app... |
A solution for this could be to use webview to handle the auth process, this way we never leave the app in the first place ! |
I tried using webview, it works but the google sign in doesnt... |
I tried use a web callback for example : https://oauth.pstmn.io/v1/browser-callback I dont get a pcke code when redirect is opened in philip hue's app : If you have an explanation of this don't hesitate ! |
I have looked extensively into this. Everything works as expected if the Hue app is not installed on the user's device. If the Hue app is installed, it intercepts the URL; in this case, remote access is granted, but it cannot send the user back to your app. This issue is on Philips Hue's end, and I cannot think of a way around it. If the user is not sent back to your app, it doesn't receive the token, and cannot use the remote access that it has been granted. I've reached out to Philips Hue for this issue and others I have had, and I have never gotten a response. I fear that they are not putting any resources into helping third-party developers, and we are on our own. |
Thank you for looking into it ! |
Yes the pkce is mandatory. It is how Philips Hue and your app confirm they are talking to each other. It prevents certain attacks. |
Hey I just cloned your repo to try the demo,
the only modifications I did was replacing the placeholders with the
clientId, clientSecret that I got from dev console
and redirectUri with https://oauth.pstmn.io/v1/browser-callback
When I try the app, on my physical or emulated android.
First I tried to call discoverBridges() (via the button)
and I get the following output without anything else happening :
I tried the official philps hue app and everything works as expected with it
I got a bridge with a play kit link
Thank you for developping this plugin, hope you can help !
The text was updated successfully, but these errors were encountered: