Replies: 2 comments 1 reply
-
Please share the full source code code you are using so we don’t have to guess. Your other remarks come down to basic PHP knowledge, for example the variable names can indeed be different from the example config file, easy fix. The examples are more about how to actually use the client class, not to teach PHP. |
Beta Was this translation helpful? Give feedback.
-
I am also seeing a 403 when trying to log in. Is there something that must be done in the controller to enable a user for API access? Skeletal code for what I am doing to login, it is quite basic:
I get this message:
I can use the username and password to login to the controller. |
Beta Was this translation helpful? Give feedback.
-
So originally i tried to setup this without composer which i couldn't get working, I have since switched to using composer which gets my leaps and bounds further along however i think i am missing something in the setup process, the setup document while well detailed seems to not explain half the information that it states within the php files it's self,
I have found that for example, My config file sets the $controlleruser where as the scripts actually looking for $controller_user
Long and short of the issue is i am running into the following error.
Notice: HTTP response status received: 403. Probably a controller login failure in C:\xampp\htdocs\Vouchers\vendor\art-of-wifi\unifi-api-client\src\Client.php on line 221
Fatal error: Uncaught TypeError: UniFi_API\Client::create_voucher(): Return value must be of type array, bool returned in C:\xampp\htdocs\Vouchers\vendor\art-of-wifi\unifi-api-client\src\Client.php:2124 Stack trace: #0 C:\xampp\htdocs\Vouchers\Index.php(50): UniFi_API\Client->create_voucher(1000, 1) #1 {main} thrown in C:\xampp\htdocs\Vouchers\vendor\art-of-wifi\unifi-api-client\src\Client.php on line 2124
And can't for the life of me work out what is stopping the connection, I have tried two different local users with different permission levels, This is on a UDM pro so i have followed the part about using port 443 instead of 8443 as this is a Unifi OS Device. I have even tried changing the IP address of the webserver (XAMP) to the primary vlan and tried connecting to no avail?
Can anyone point me in the right direction or give me a clue on where i am going wrong?
Beta Was this translation helpful? Give feedback.
All reactions