(After upgrading to Openfire from 4.1. 6 to 4.8.1) While doing POST request to user service, getting connection refused error as below:

POST /plugins/userService/userservice?type=add&secret=userflow&username=rad100&password=rad100&name=100,%20rad HTTP/1.1

[Fiddler] The connection to abcxyx.abc.isyntax.net’ failed.
Error: ConnectionRefused (0x274d).
System.Net.Sockets.SocketException No connection could be made because the target machine actively refused it [::1]:9090

Please be aware that you’re copy/pasting a secret and a password in a forum post that is public. You may have leaked sensitive information

You appear to attempt to use the deprecated User Service plugin. I do not know if this works with Openfire 4.8.1. You should consider switching to the REST API plugin.

I’m not sure why the old plugin is no longer working. Have you verified that it is installed? Have a look at the Openfire log files, to find clues to find out why you’re running into issues with it.

Thanks Guus. We had used dummy credentials here.
As per the suggestion we enabled rest API in admin console and validated the sample POST request as below, however we are getting the connection failed error

POST http://abcxyz.abc.isyntax.net:9090/plugins/restapi/v1/users HTTP/1.1
Authorization: xxx
User-Agent: Fiddler
Host: HostName:9090
Content-Length: 124

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>test3 test

HTTP/1.1 502 Fiddler - Connection Failed
Date: Tue, 21 May 2024 15:55:21 GMT
Content-Type: text/html; charset=UTF-8
Connection: close
Cache-Control: no-cache, must-revalidate
Timestamp: 08:55:21.489

[Fiddler] The connection to ‘HostName’ failed. Error: ConnectionRefused (0x274d). System.Net.Sockets.SocketException No connection could be made because the target machine actively refused it [::1]:9090

That is a very generic network error. Have you verified that the plugin is installed correctly? Please look at the Openfire log files around the time that the plugin was installed (or is reloaded). It might contain messages that shed light on the failure.

Thank you for your patience and prompt responses. Yes. We verified the logs, and the plugin was installed properly. We changed our URL from hostname to localhost.
(POST http://localhost:9090/plugins/restapi/v1/users HTTP/1.1) Now we are getting unauthorized error and hence we tried the same in swagger UI which also showed the same unauthorized error.


I suspect that this is caused by an incomplete installation/configuration of the plugin. Please verify if you followed this instruction:

Important Step: To enable the plugin make sure to set the system property adminConsole.access.allow-wildcards-in-excludes to true

Without the above step the REST API plugin always redirects to login. This was done in response to a security issue.

Hi Guus, Thanks for the quick response. I had changed the server property value( adminConsole.access.allow-wildcards-in-excludes = true). But still having 401 error

I apologize for my misunderstanding. We had also added a couple additional properties. After we removed it, it started to work.
Thanks Guss for your continues support. We really appreciate your timely effort.

1 Like