Skip to content
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

UniFi v9 #711

Open
patrickclover opened this issue Jan 13, 2025 · 4 comments
Open

UniFi v9 #711

patrickclover opened this issue Jan 13, 2025 · 4 comments
Labels
bug Something isn't working needs triage need to check labels

Comments

@patrickclover
Copy link

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. (/app/node_modules/unifi-client/lib/UnifiAuth.js:284:39)\n' +
app-1 | ' at step (/app/node_modules/unifi-client/lib/UnifiAuth.js:59:23)\n' +
app-1 | ' at Object.next (/app/node_modules/unifi-client/lib/UnifiAuth.js:40:53)\n' +
app-1 | ' at fulfilled (/app/node_modules/unifi-client/lib/UnifiAuth.js:31:58)\n' +
app-1 | ' at processTicksAndRejections (node:internal/process/task_queues:96:5)'
app-1 | }

Steps to Reproduce

Call the login function against a controller running v9

@patrickclover patrickclover added bug Something isn't working needs triage need to check labels labels Jan 13, 2025
@thib3113
Copy link
Owner

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 .

@davey-g-uk
Copy link

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.

@thib3113
Copy link
Owner

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 .

@patrickclover
Copy link
Author

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
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage need to check labels
Projects
None yet
Development

No branches or pull requests

3 participants