'Chocolatey failed to download app from my source(via powershell)

I put a software on my Chocolatey Package Repository and want to install it, but the downloaded URL is from my Laravel website, the website needs to be logged in to download files, so Chocolatey will have an error and cannot be installed, how can I install this application?

I search some solution following, but still can't work it:

How to Download a File with PowerShell

The above website mentioned that if the website needs to log in to download, you can use the sample code in the website, but I still can't download it.

Install the chocolatey software error message with CMD

The teaching content (PowerShell) provided in other websites, the token is returned after the test login, but it seems that there is no login:

$azr = Invoke-WebRequest -Uri 'http://127.0.0.1:8080/login' -SessionVariable sbv
$sbv
$dbform = $azr.Forms[0]
$dbform
$dbform.fields

$dbform.Fields["email"] = "[email protected]"
$dbform.Fields["password"] = "Jason123"
$r = Invoke-WebRequest -Uri ("http://127.0.0.1:8080/login"+$dbform.Action) -WebSession $sbv -Method POST -Body $dbform.Fields
Write-Host $r

This is the result of the postback:

Headers               : {}
Cookies               : System.Net.CookieContainer
UseDefaultCredentials : False
Credentials           : 
Certificates          : 
UserAgent             : Mozilla/5.0 (Windows NT; Windows NT 10.0; zh-TW) WindowsPowerShell/5.1.22000.652
Proxy                 : 
MaximumRedirection    : -1

Id     : login-form
Method : post
Action : 
Fields : {[_token, RJy6l5rj18yDuGeHOCweTsBCKzfjBgi64eO0w3Sf], [email_id, ], [password_id, ]}

Key   : _token
Value : RJy6l5rj18yDuGeHOCweTsBCKzfjBgi64eO0w3Sf

Key   : email_id
Value : 

Key   : password_id
Value : 

How can I login to the website correctly?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source