Add an option to Invoke-RestMethod to send HTTP Basic Authentication immediatly
Votes from Connect: 11
Original Date Submitted: 6/5/2012 2:35:42 PM
Handle: Markus Essl
Site Name: PowerShell
Feedback ID: 746546
Frequency: Always Happens
Regression: I don't know if this issue existed previously
Currently, when you use Invoke-RestMethod, it will only send http basic authentication headers when a access denied response is coming from the server. Quite some REST web services (like Jira) do not do that, because they (a) allow anonymous users as well as authenticated ones and/or (b) they want to avoid the unneccessary round trip.
wget and curl have corresponding options to allow to call the service without redirects (--auth-no-challenge in wget).
Product Studio item created by Connect Synchronizer due to creation of feedback ID 746546 (http://connect.microsoft.com/PowerShell/feedback/ViewFeedback.aspx?FeedbackID=746546).
We should do this when we rewrite the web cmdlets
Internal BugId: 3612
John B commented
GitHub also does not send the 401, for security reasons.
Currently, I have to generate my own base-64 Authorization string for Invoke-WebRequest, Invoke-RestMethod, etc. That should come automatically from credentials parameter. Please fix.