Authorizing User through code:
String url = "http://localhost:4984/sync_gateway/_user/GUEST";
URL obj = new URL(url);
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
String urlParameters = "{\"disabled\":\"false\", \"admin_channels\":[\"public\"]}";
// Send post request
con.setDoOutput(true);
DataOutputStream wr = new DataOutputStream(con.getOutputStream());
wr.writeBytes(urlParameters);
wr.flush();
wr.close();
after executing this is code getting response code : 405 and user is also not authorized. kindly tell me is this a correct way for Authorizing Users?