Login with Powershell to website, cant find the right fields

64 views Asked by At

Im struggling logging in to a website. I did find the form "bs-dummy-login-form" with the following request

$Site = Invoke-WebRequest 'https://www.mystique-dummy.eu/login'
$Site
$Site.Forms
$Site.InputFields

If i understand it right, are the names of the fields: login and password. I cant find the name of the token. Tried it also with Dev Tools. Seems to be hidden.

My code that i have changed from a previous working script:

$LoginUri = "https://www.mystique-dummy.eu/login"
$LoginResponse = Invoke-WebRequest -Uri $LoginUri -SessionVariable "Session"
$LoginBody = @{
    authenticity_token = $LoginResponse.InputFields[1].value
    login = "anyemail"
    password = "anypassword"
    submit = "Sich anmelden"
}
$LoginResponse = Invoke-WebRequest -Uri $LoginUri -WebSession $Session -Body $LoginBody -Method "POST"

Invoke-WebRequest -Uri 'https://www.mystique-dummy.eu/download/csv/feed.csv'  -OutFile '.\feed.csv'

It gives a 404. I think the Login has not worked properly. Does anyone have an idea how to solve it? Sorry if i do not find the exact expressions/words, im from Germany.

With kind regards, Alex

0

There are 0 answers