Page 1 of 1

Advanced HTTP Handling - e.g. AutoLogin

Posted: 01 Jul 2019 08:12
by Snify
Hello all,

Automagic currently has a good and stable HTTP Request Action with some already nice features.
However, for my needs (and maybe for others as well), it is not quite enough (yet).

At the moment, there is a "bug", which, if it gets solved, can open up many opportunities from scratch.

With this, you can already program flows, which can let you automatically login to a website, upload a file to a webserver and/or parse your desired value (which can be tracked for changes, etc.)

Examples:
  • Login to paypal with your credentials - parse your current balance - show the balance in a widget / get notification about changes / make payments / etc ...
  • Track a sale listing and get notified when the price changes or stock has been refilled
  • Login to any site and check for messages, etc.
  • Login to any site and submit a message/picture/anything...
  • Check weather
  • Check anything!
  • Your Webservice doesn't have an API? No problem, use HTTP Requests yourself =)
  • Many more purposes...
All of this is already possible with Automagic (except for the possible unexcpeted results from the above mentioned issue) - if you know HOW.

For easier access to such a feature, there is already a plugin called WebAlert , which tracks your login via a webview and stores/follows all your submits and requests.

There are 2 issues with this:
1. It is slow. Due to processing via the WebView - it eats resources like time, internet traffic (due to images/scripts load), etc.
2. It won't let you dynamically change the form item names. (Some sites have dynamic form item names, but are always in the same order (index))

Good thing is: It is easy to use and handles all the javascript/cookies/form stuff.

So my feature request is actually to have a WebView available for the user (to login, select the element you want to track, etc.) - and later be able to send only native HTTP Requests - thus, images, etc. don't need to load.
Also if there's the need and time - adding some script functions/procedures which can handle HTML Source / Cookies such as parsing form(s)/item(s)/values/etc. by Index and/or name.


Thanks for reading =)

Re: Advanced HTTP Handling - e.g. AutoLogin

Posted: 06 Jul 2019 17:40
by Desmanto
This will be a very useful addition. But I don't know if it is possible to implement this. As different website will have different login handling.

What I do until now is to go the login page of the website. use chrome and turn on developer setting. Then I study the way it handle the username/password post and parameter. Sometimes I have to read thru the sources too. Then mimic that login method in the HTTP request. So far so good, I can even read thru the banking login, to retrieve some info.

The problem with this is, different website use different script, so have to do it one by one per website. And if the login method change even just a bit, we have to modify the flow again to suit to that change. An automated UI from Automagic will be wonderful and simplified this down.

Re: Advanced HTTP Handling - e.g. AutoLogin

Posted: 07 Jul 2019 07:36
by Snify
I use fiddler to trace such logins. Never needed Javascript - however it might have useful information about other necessary requests, dynamic cookie operations etc. You should at least look at the html <script> and <noscript> elements. Since I have added a DOM in my projects - I can handle logins much easier by using ids based on form order. Since AM has already implemented cookie handling, it has all the basics needed to make any login (except you can't clear the cookies yet).

Re: Advanced HTTP Handling - e.g. AutoLogin

Posted: 07 Jul 2019 14:37
by Desmanto
I ever try fiddler, but it doesn't work well with https traffic. Then I discover Chrome has the tool built-in already and it can handle the https by itself (since no external program needed).

Re: Advanced HTTP Handling - e.g. AutoLogin

Posted: 07 Jul 2019 14:41
by Snify
Fiddler does support ssl very well. You can even make a lot of changes during a request or response. But yeah the chrome tools work too ofc :)

Re: Advanced HTTP Handling - e.g. AutoLogin

Posted: 07 Jul 2019 20:34
by Horschte
Desmanto wrote:
06 Jul 2019 17:40
What I do until now is to go the login page of the website. use chrome and turn on developer setting. Then I study the way it handle the username/password post and parameter. Sometimes I have to read thru the sources too. Then mimic that login method in the HTTP request. So far so good, I can even read thru the banking login, to retrieve some info.
Can you please explain a little bit further - maybe using an example login? I don't understand most of chrome's developer tools.
Thanks a lot. :)

Re: Advanced HTTP Handling - e.g. AutoLogin

Posted: 08 Jul 2019 16:27
by Desmanto
@Horschte : Just try Automagic forum login.
ucp.php?mode=login

Press F12 at chrome, then go the network tab. Click that login with your username and password, you should see the http post sent at ucp.php?mode=login

You can see the Form data at the below. If you click on the view source, you can see how the form data was formed. You can replicate this at Automagic HTTP request action and put the proper username password, use POST method.

Re: Advanced HTTP Handling - e.g. AutoLogin

Posted: 08 Jul 2019 20:02
by Horschte
Thank you. That helps a lot. :)