0

I want to get the authentication from moodle (say the moodle site from our university) in my android application. And I do not have the access to the database. I tried to make a http post request from my application with username and password.

But when I execute the post request, I get an exception. This is what I have tried

private URI url = new URI("https://online.mrt.ac.lk/login/index.php"); 
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(url);
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(); 
nameValuePairs.add(new BasicNameValuePair("username", "user")); 
nameValuePairs.add(new BasicNameValuePair("password", "password"));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();
InputStream is = entity.getContent();

I get a exception like this

javax.net.ssl.SSLPeerUnverifiedException: No peer certificate

Please someone help me.

Maduranga Siriwardena
  • 1,341
  • 1
  • 13
  • 27

0 Answers0