GitHub user its-dikshit closed a discussion: Issue with Invoke-RestMethod Returning 401 Unauthorized in Apache Hop Server
### 🔹 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:** ```sh 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:** ```powershell Invoke-RestMethod -Uri "http://localhost:8080/hop/status" ``` ➡ Returns **401 Unauthorized** **3) Try Using Basic Authentication in PowerShell:** ```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.xml` File:** ```xml <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:** ```sh docker restart hop-server ``` ✔ **Generating an MD5 hash for the password and updating hop-server.xml:** ```sh echo -n "admin" | md5sum ``` **✔ Copying the updated file back and restarting the server.** **Expected Behavior:** The request should return 200 OK with the Hop Server status. **Actual Behavior:** The request fails with 401 Unauthorized every time. **Question:** How can I correctly authenticate Invoke-RestMethod to interact with Apache Hop's REST API? Am I missing any additional configuration?     I would greatly appreciate any insights or guidance! ### 🙏 Thanks in advance for your help! GitHub link: https://github.com/apache/hop/discussions/5020 ---- This is an automatically sent email for [email protected]. To unsubscribe, please send an email to: [email protected]
