0

I'm trying to make an android application and so i want to connect it directly to my Joomla website, i want to send some post requests but they are getting denied, I'm not asking for any help regarding Android, im just asking for anything regarding POST requests We all know that Joomla has CSRF protection which creates a hidden form with a random name and a value, is there a way i can get the name and the value of that form, so that i can add it with my post request and thank you for your time.

  • 1
    The usual way is to do a GET to get the Joomla form (including the token in a hidden field), then do a POST to send the form data including the token. Is there a reason why you can't do that? – Robbie Jackson Feb 29 at 20:14
  • @RobbieJackson yes, our college website is crappy and when many people login to it to see there grades once we know that they're out, the website becomes unable to handle this ton of requests so it turns off, it's hard accessing it and viewing your grades, so i thiught of creating an app where it monitors thr website snd the change in html, then logs it in, after it changes its content, i would know that new grades were added. – user71381 Feb 29 at 21:04
  • I have to also mention that our college administration never tells us that new grades were added, so one can only know that new grades were added if he logs into the website by mistake, thats the main reason why am making this app, to notify me of new grades – user71381 Feb 29 at 21:06
  • 1
    OK, the answer is still the same then. You should emulate a browser by sending an HTTP GET to the website, capture the returned token and send it with the data in the POST. You could do this with the login form to send usr/pwd. However, there's probably an easier way to do that though than developing an android app, eg curl? And if a lot of people are automatically doing this regularly to an overloaded server it's probably only going to make things worse I fear. – Robbie Jackson Feb 29 at 22:50
  • @RobbieJackson the app is going to be used only by me, not by my colleagues, and Joomla, will it return the token with a get request and how can i get it, is there a specific file or a way or code snippet or anything that can help? – user71381 Feb 29 at 22:53
0

The problem was me not adding the Cookie manager at the dtart of the code, as such for every get request to the server i received a new Token, and so after adding the Cookie manager i was able to get a token which was still the same after each Get request and so I was able to send a Post request and login through a mobile app, thank you alot for all of your help

| improve this answer | |
  • If you have resolved your own question, please award your answer the big green tick so that the system stops bumping this page. – mickmackusa yesterday

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.