Invoke-WebRequest with digest
See original GitHub issueWe have a script that runs just fine on Powershell 5, but when executing on devops agenst running ubuntu and powershell core 7.1 it always fails with a 401 Error.
$Password = ConvertTo-SecureString $MongoAtlasApiKeyPrivate -AsPlainText -Force
$Credentials = New-Object System.Management.Automation.PSCredential ($MongoAtlasApiKeyPublic, $Password)
Invoke-WebRequest -Uri $MongoAtlasApiUrl -Method POST -ContentType "application/json" -Credential $Credentials -Body $json
It’s trying to callt he mongo atlas api, which according to mongo’s documentation requires digest authentictaion. However I couldn’t find anything mentioning digest with Invoke-WebRequest. Onlny Oauth and other auth methods, but nothing about digest. Is it just no possible anymore since PWSH 6/7?
This is the corresponding mongo documentation: https://docs.atlas.mongodb.com/reference/api/whitelist-add-one
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Is it possible to use digest authentication with invoke- ...
I've been trying to find some reference to doing this but I haven't been able to find anything besides the chilkat reference.
Read more >View topic - [SOLVED]Powershell restful authentication
I'm trying to use Powershell to access one or two things via the API. I'm using. Code: Select all: Invoke-WebRequest -URL $url -credential...
Read more >Use Invoke-WebRequest with a username and password ...
Use Invoke-WebRequest with a username and password for basic authentication on the GitHub API · $pair should be $pair = "$($user):$($pass)" Check ...
Read more >Invoke-WebRequest - PowerShell
The Invoke-WebRequest cmdlet sends HTTP and HTTPS requests to a web page or web service. It parses the response and returns collections of...
Read more >Using PowerShell Invoke-RestMethod with REST APIs
The Invoke-RestMethod and Invoke-WebRequest functions of PowerShell allow easy interactions with an API and aid in creating complex workflows.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@iSazonov I think we can close, the issue underlying with dotnet was fixed, It works correctly in PS7.3.2 Test:
This issue has been marked as external and has not had any activity for 1 day. It has been be closed for housekeeping purposes.