Art-of-WiFi / UniFi-API-client

A PHP API client class to interact with Ubiquiti's UniFi Controller API
MIT License
1.09k stars 217 forks source link

Controller 8.0.2 #202

Closed aroundmyroom closed 7 months ago

aroundmyroom commented 8 months ago

8.0.2 is early access and I do not expect that this is going to work yet, but it seems that the login procedure for this API looks changed

I cannot logon anymore..

malle-pietje commented 8 months ago

I haven’t tested this yet. Was this on UniFi OS or was it a software-based controller?

aroundmyroom commented 8 months ago

Unifi OS 3.2.5 with controller 8.02 (Cloudkey gen2 plus) it's not biggy that it is not working and possibly my mistake but it was working before I updated to 8.0.2 ..

malle-pietje commented 8 months ago

I upgraded our test software-based controller to 8.0.2, and I see no issues whatsoever. Here is the about modal from the API Browser with details of the controller and the API client version: image

I think you have another issue, or you were using port 8443 instead of 443 as required for UniFi OS-based consoles.

I'll see when I have time to replicate this with a UniFi OS console.

malle-pietje commented 8 months ago

If you want to help troubleshoot this, please share the sanitized debug output after enabling debug mode.

malle-pietje commented 8 months ago

I've tested the API client here with an even newer Network Application version (8.0.4) on a UDR, and it works fine. Here's a screenshot from one of our applications: image

malle-pietje commented 8 months ago

I am closing this issue now. Please re-open if needed.

thib3113 commented 7 months ago

Hello @malle-pietje I do some debug on this .

And it come with unifi OS 3.2.X . In fact this part https://github.com/Art-of-WiFi/UniFi-API-client/blob/master/src/Client.php#L172-L178 doesn't works with unifi OS > 3.2.X ( unifios stop sending x-csrf-token )

malle-pietje commented 7 months ago

Hello @malle-pietje I do some debug on this .

And it come with unifi OS 3.2.X . In fact this part https://github.com/Art-of-WiFi/UniFi-API-client/blob/master/src/Client.php#L172-L178 doesn't works with unifi OS > 3.2.X ( unifios stop sending x-csrf-token )

Not to be rude, but I don't believe there is an issue with 3.2X. Here's a screenshot from a test with a UDR running 3.2.5 and Network Application 8.0.4: image

Please provide more details and proof about what isn't working. Are you perhaps not using port 443 but using 8443 instead?

malle-pietje commented 7 months ago

image

thib3113 commented 7 months ago

@malle-pietje hum ... my bad, re-reading, your library doesn't check the header x-csrf-token ... So I don't know why it crash here ... (I got a notification about this issue, and use it to extract the version of the OS/network)

( I'm digging on another libraries , on another language, and it seems that 3.2 stop sending the header x-csrf-token, so if the library check on this header to detect unifios/controller, it will stop working on 3.2 ) .

malle-pietje commented 7 months ago

@thib3113 Okay, please share the full, sanitised, debug output when logging in and for example fetching the sites. Since I can't reproduce this, I'll have to wait for further data.

thib3113 commented 7 months ago

@malle-pietje no no ... that's my bad ... I didn't reproduce with this library ... I wrote too fast .

( as I said, I'm digging this bug, because I got the same with node.js libraries ... and I think the bug here was the same as us ... so "no x-csrf-token header" . But, you are not checking it ... so I don't reproduce the same bug )

malle-pietje commented 7 months ago

Thanks, understood. Closing this issue.