0

Following the documentation for the Duo Security Admin API, I am trying to create/delete a user. The documentation only indicates that a post command needs to be used. No examples are given and I’m not sure where to start.

I am trying to create a user and also delete a user using the following code. Neither works as I am not seeing the user being created or deleted in my admin console.

{"code": 40101, "message": "Missing request credentials", "stat": "FAIL"}

When I paste my URL I get this error and user is not created. What am I doing wrong?

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class duo {
    public static void main(String[] args) throws IOException, InterruptedException {
        // Create a neat value object to hold the URL
        URL url;
        url = new URL("https://api-e9770554.duosecurity.com/admin/v1/users");

        // Open a connection(?) on the URL(??) and cast the response(???)
        HttpURLConnection connection = (HttpURLConnection) url.openConnection();

        // Now it's "open", we can set the request method, headers etc.
        connection.setRequestProperty("accept", "application/json");

        // This line makes the request
        InputStream responseStream = connection.getInputStream();
    }
}
John Kugelman
  • 349,597
  • 67
  • 533
  • 578
  • Related: [Creating a User using Duo Security Admin API](https://stackoverflow.com/questions/51508629/creating-a-user-using-duo-security-admin-api) – John Kugelman Aug 12 '21 at 11:14
  • I checked that question but I am still not able to understand it. – DaveMustaine Aug 12 '21 at 11:19
  • ?Date=Sat,14Aug202105:06:46+0000&Integration key:Secret key=DILV6EJV15MYP20WO801:DLr5bzSztvhL2Po4gSSN4E0AOIqEUaW72gYbB0r9&=api-e9770554.duosecurity.com&=/admin/v1/users&=username=xyz Now I am getting no response – DaveMustaine Aug 14 '21 at 07:07

0 Answers0