-
-
Save breezhang/3523645 to your computer and use it in GitHub Desktop.
Powershell basic authentication
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//This returns a 404 not found - powershell; I expected a 401 if my creds were bad | |
$Url = "https://github.com/api/v2/xml/commits/list/fellowshiptech/portal/Portal_2011.6.23_15-26" | |
$webclient = new-object system.net.webclient | |
$webclient.credentials = new-object system.net.networkcredential("user", "password") | |
$result = $webclient.DownloadString($Url) | |
$result | |
//This returns the data I want via terminal | |
curl -u user:password https://github.com/api/v2/xml/commits/list/fellowshiptech/portal/Portal_2011.6.23_15-26 | |
//Here's how to do it via powershell - though I am not a fan of the implementation | |
$webclient = new-object system.net.webclient | |
$result = $webclient.DownloadString("https://github.com/api/v2/xml/commits/list/fellowshiptech/portal/Portal_2011.6.23_15-26?login=:user&token=:token") | |
$result | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment