Issue with Invoke-RestMethod Returning 401 Unauthorized in Apache Hop Server #5020
-
🔹 Greetings, Apache Hop Community!I am running an Apache Hop server inside a Docker container and trying to authenticate API requests using Invoke-RestMethod in PowerShell. However, I keep getting a 401 Unauthorized error, despite setting the correct username and password. Steps to Reproduce:1) Start Hop Server in Docker: docker run -d --name hop-server -p 8080:8080 -e HOP_SERVER_USER=admin -e HOP_SERVER_PASS=admin apache/hop:latest 2) Check Server Status: Invoke-RestMethod -Uri "http://localhost:8080/hop/status" ➡ Returns 401 Unauthorized 3) Try Using Basic Authentication in PowerShell: $headers = @{
"Authorization" = "Basic " + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("admin:admin"))
}
Invoke-RestMethod -Uri "http://localhost:8080/hop/status" -Method Get -Headers $headers → Still returns 401 Unauthorized 4) Checked the <hop-server-config>
<hop-server>
<name>Hop Server</name>
<hostname>0.0.0.0</hostname>
<port>8080</port>
<shutdownPort>8079</shutdownPort>
<username>admin</username>
<password>admin</password>
<authentication>true</authentication>
</hop-server>
</hop-server-config> → Authentication is enabled, but the REST API still returns 401. What I Have Tried:✔ Restarting the container: docker restart hop-server ✔ Generating an MD5 hash for the password and updating hop-server.xml: echo -n "admin" | md5sum ✔ Copying the updated file back and restarting the server. Expected Behavior: Actual Behavior: Question: I would greatly appreciate any insights or guidance! 🙏 Thanks in advance for your help! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Your first command lets me successfully authenticate with admin/admin if I just copy/paste it. |
Beta Was this translation helpful? Give feedback.
Your first command lets me successfully authenticate with admin/admin if I just copy/paste it.
The later points look incomplete and don't follow the documentation. Use
hop-encrypt.sh
for your password, specify the configuration file, the default config file is in/opt/hop
, not/tmp
etc.