jaroschek / home-assistant-myuplink

Custom Home Assistant integration for devices and sensors in myUplink account.
44 stars 10 forks source link

Error creating Application on dev.myuplink.com #9

Closed cnestande closed 1 year ago

cnestande commented 1 year ago

Hi, Not really a bug with your code, but when I try to add a new application to dev.myuplink.com I get an error: Callback Url must be a valid URL I have entered the following callback url: https://my.home-assistant.io/redirect/oauth

Screenshot 2023-06-12 at 12 56 59

Any idea on how I can resolve the issue?

soulfire89 commented 1 year ago

Same issue here. I think you need to replace "my.home-assistant.io" with your Homeassistant IP, but I'm new to it and not 100% sure

cnestande commented 1 year ago

I tried, but that didn’t work. Did you make it work?

soulfire89 commented 1 year ago

yes, i did it, follow instruction from here https://dev.myuplink.com/

But I'm struggling with the next step....

soulfire89 commented 1 year ago

@jaroschek Do you think it will be possible to get a more detailed instruction up to the picture from your example?

bever66 commented 1 year ago

@jaroschek Same here, "https://my.home-assistant.io/redirect/oauth" isn't accepted in the myuplink application setup and filling in the IP address does not work either. A solution would be appreciated. Thanks in advance!

soulfire89 commented 1 year ago

try it with this Link http://home-assistantipadresse:8123/redirect/oauth and change home-assistantipadresse into yours.

Some of the requests work at https://api.myuplink.com/swagger/index.html, but I have no idea how to work with this inside home-assistant.

EDIT:

Now it's not possible to change something.

jaroschek commented 1 year ago

Hello, I have to admit that I'm quite busy at work currently and don't have much time to view into this issue. But I hope I can clarify these newly problems.

First of all this all was working like expected, some weeks ago. I could setup this whole integration using the standard callback-url from Home Assistant that you tried: https://my.home-assistant.io/redirect/oauth

Unfortunately the developers at myUplink seem to have added some restricted validation to the form where you can create an application.

The form is currently build in this javascript: https://dev.myuplink.com/static/js/pages/Apps/components/CreateNewAppForm/CreateNewAppForm.js

There it references a callbackURLRegex at line 29. This regex is then provided by this javascript: https://dev.myuplink.com/static/js/components/constants/constants.js export const callbackURLRegex = /^https?:\/\/\w+(\.\w+)*(:[0-9]+)?(\/.*)?$/;

So it does allow multiple combinations of words for the host/domain.

BUT: It does NOT allow any signs like the dash - that is right in the middle of home-assistant.

That is currently a limitation only the developers of the developer-portal from myUplink can fix.

We have to try to use the support to file an issue to get this solved.

Until then can we only successfully create a new application there by using host-/domain-names with whole word.

jaroschek commented 1 year ago

Hello @soulfire89, regarding your problem with the invalid request... this seems to be the same as in the first issue https://github.com/jaroschek/home-assistant-myuplink/issues/1

I think the main problem here was, that you can not (successfully) change the callback-url of an existing application in the developer-portal for myUplink. If you want to change the callback-url (perhaps for testing reasons), you will have to create a new application. And to not confuse your Home Assistant installation, you should also delete any saved credentials for the myUplink integration there.

soulfire89 commented 1 year ago

BUT: It does NOT allow any signs like the dash - that is right in the middle of home-assistant.

I can confirm that. After deleting "-" between home-assistant. It will unshow the "Callback Url must be a valid URL", but it won't work without "-"

Support mail with your previous information about changes policy is out: gdpr@myuplink.com

cnestande commented 1 year ago

I have also reported it to myUplink from the contacts page on the “non-developer” login. There is a form I filled out. I got a response that the developers have been notified. Hopefully it is a quick fix, I assume this is only frontend…

soulfire89 commented 1 year ago

Hi and thank you for contacting Team NIBE Uplink! Unfortunately, we currently have a bug that does not allow hyphens, but we thank you for your feedback and expect it to be resolved within a week or so, we must apologize if it causes problems for you.

Seems like it's allready ongoing.

bever66 commented 1 year ago

I wonder if the "-" character is the only issue. I use my own domain name which is straight foward without any dash whatsoever and I still get the "invalid request" response from myuplink.

supergregg commented 1 year ago

I think you get that because Homeassistant hard codes every oauth to pass through the my.home-assistan.io site. You can see that if you go back to HA after the "invalid request" and copy the URL from the "Open page" button. The Link there does not use your local URL. I tried manipulating this link, entering my internet facing HA, that results in getting a screen from MyUplink requesting access (as expected). But Pressing Yes, just results in an Error message back in HA, guessing due to the manipulated URLs. The Only way to disable the my.home-assistant.io is to break apart the "default_config:" and exclude "My Home Assistant " and that is a bit of a pain as it needs to be maintained.

AbsolutJohan commented 1 year ago

This has been fixed on their end today and you can use https://my.home-assistant.io/redirect/oauth as callback URL again 😀

soulfire89 commented 1 year ago

Problem solved!

cnestande commented 1 year ago

Yes, I also made it work today. I'll close the ticket.