UniFi v9
Prerequisites
Please answer the following questions for yourself before submitting an issue.
- [*] I am running the latest version
- [*] I checked the documentation and found no answer
- [*] I checked to make sure that this issue has not already been filed
Current Behavior
When running on > 9.0 authentication/login method fails
Failure Information
The error returned from the, working under the assumption that the cookie keys have changed
ClientError {
app-1 | toString: [Function (anonymous)],
app-1 | name: 'Error',
app-1 | errorCode: 2,
app-1 | code: 2,
app-1 | _message: 'fail to get CSRF token from cookies',
app-1 | message: 'fail to get CSRF token from cookies',
app-1 | exception: undefined,
app-1 | stack: 'Error : fail to get CSRF token from cookies\n' +
app-1 | 'Error: \n' +
app-1 | ' at generateStack (/app/node_modules/unifi-client/lib/Errors/__Error.js:35:28)\n' +
app-1 | ' at ClientError.__Error (/app/node_modules/unifi-client/lib/Errors/__Error.js:49:22)\n' +
app-1 | ' at new ClientError (/app/node_modules/unifi-client/lib/Errors/ClientError.js:25:23)\n' +
app-1 | ' at UnifiAuth.
Steps to Reproduce
Call the login function against a controller running v9
Hi @patrickclover . I will need more informations to help you ...
Can you try to check with debug logs if you can get more informations ?
Actually, my unifiOS is running network 9.0.108 . And authentication works .
I am having similar issues when try to connect, running v0.11.0 of the package, and unifi is running 9.0.108.
I am getting HTTP response code 400 when executing the controller.login() method.
Happy to do some debugging for you let me know how I can get some files across, I caught the TTY output when it dies but log file is 2.5MB text file and 686000 lines just form trying to make the login call. Not sure you want all of that.
hum ...
You can search for the log : unifi-client:UnifiAuth:login os found : to check if it correctly detect if you use unifiOS or not ?
Searching this log, it only happen when you are using unifi software, without unifiOS, is it the case ?
( I just tried to update my test setup of network app, but the docker image is deprecated and not updated with V9 .... and not really the time to do the upgrade now ... )
If you want, you can send me the log to thib3113[at]gmail[dot]com . I can try to check if I can get the informations .
The issue is the error throwing in the UnifiAuth function. The check for unifiOs is now void as UniFiOS and v9 self hosted respond in the same way.
throw new ClientError(
'fail to get CSRF token from cookies',
EErrorsCodes.FAIL_GET_CSRF_COOKIE
)
Hi @patrickclover and @davey-g-uk .
I finaly got the time to migrate my test environment to v9, and in fact, I correctly receive the csrf token from headers .
I didn't have lot of time to try, but, it seems to not be the same thing on all v9 .
On my side I'm using unifi network through docker : https://github.com/linuxserver/docker-unifi-network-application / and unifiOS on an UDM pro
What are you using on your side ? UnifiOs or running on other os ? user is admin ? 2FA ? local ? other ideas ?
Ok, I got it ... UI add a strict = true on login request ... and so it return the csrf token
Can you confirm if V0.11.1 fix your problem please ?
Hi,
I tried v0.11.1 and still get the same:
For your reference, I am running the unifi controller in a container (http://lscr.io/linuxserver/unifi-network-application) on an UNRAID NAS.
Container updated today and is now running controller version 9.0.114
I run the web interface for the controller through a nginx reverse proxy but I have tried bypassing this and get the same error.
Thanks
David
---- On Sun, 09 Feb 2025 17:22:27 +0000 Thibaut SEVERAC @.***> wrote ---
Can you confirm if https://github.com/thib3113/unifi-client/releases/tag/v0.11.1 fix your problem please ?
— Reply to this email directly, https://github.com/thib3113/unifi-client/issues/711#issuecomment-2646424581, or https://github.com/notifications/unsubscribe-auth/AC3QPDYZ2NVKU36NRFDVFDL2O6FFHAVCNFSM6AAAAABVCRKLYSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNBWGQZDINJYGE. You are receiving this because you were mentioned.
@davey-g-uk always the same error ? O_o
Hello,
I am using 0.11.1 in homebridge-UniFi-firewall and do not see an authentication issue with 9.0.114. I have SSL certificate checking turned off in that homebridge plugin (all local testing at present).
Dream Machine Special Edition
Just wanted to chime in and say that auth piece works for me, yet the getRules() does not as per discussion thread from yesterday.
Thanks team, have a great day, Nick