Use moodle authentication in a external application.

Use moodle authentication in a external application.

од Maduranga Siriwardena -
Број на одговори: 1

I want to get the authentication from moodle (say the moodle site from our university) in my android application. 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();

Please someone help me.

Просек на рејтинзи: -