Shortcut to automatically login to a web page

Hey guys,
I’m trying to learn how to automatically login to a web site via Shortcuts…
I think that’s something to do with the "get contents of url” and then checking "form” and "put”, and writing the user and pass ids I can get from the html code. The problem is that I can’t figure out what to do next, as simply doing these steps won’t login to any web site…
Can someone give me a hint of what am I doing wrong?

Thanks !

1 Like

For starters, you would actually be using a POST request, not a PUT.

The easiest way to find out the values you need to plug in to the “Get contents of url” action is to open up a desktop web browser. It has to be on a desktop as far as I know unless there is a mobile browser with a developer tools.

For demo purposes, I’ll explain using Chrome, but the process is similar for other browsers.
In Chrome, go to the website you want to login to. Press F12 to open Chrome Developer tools. Click on the Network tab. Login and then you will see a bunch of requests coming through in the Network panel. Find the one that looks like it would be a login endpoint. Click on it and a panel to the right opens. You can inspect the headers, payload, and response among other things for that request.

If you don’t care enough to understand the logic behind anything, just copy all the headers to the action. However, for the payload, you will need every key/value pair.

Hope this helps! :slight_smile:

1 Like

Thank you so much!! Will try it

For what it’s worth I found in shortcuts if you do url block, then get url contents, set to post then form and add username value, password value and whatever else you need like api key or secret key.

Should return a login session id or it did for me using api for a database we use. I am actually looking at using scriptable to do my get, list and post request and then do the formatting to display in tables but use shortcuts to give it a menu system and some variables for the searching.

Still pretty early in the development though.