Merge pull request #324 from bluzytrix/CSP-API-Authorize-fix

Fixing the authorize request to use the recently updated API change. …
This commit is contained in:
Kyle Ruddy
2019-11-21 18:23:13 -05:00
committed by GitHub

View File

@@ -37,7 +37,7 @@ Function Connect-NSXTProxy {
}
}
$results = Invoke-WebRequest -Uri "https://console.cloud.vmware.com/csp/gateway/am/api/auth/api-tokens/authorize?refresh_token=$RefreshToken" -Method POST -ContentType "application/json" -UseBasicParsing -Headers @{"csp-auth-token"="$RefreshToken"}
$results = Invoke-WebRequest -Uri "https://console.cloud.vmware.com/csp/gateway/am/api/auth/api-tokens/authorize" -Method POST -Headers @{accept='application/json'} -Body "refresh_token=$RefreshToken"
if($results.StatusCode -ne 200) {
Write-Host -ForegroundColor Red "Failed to retrieve Access Token, please ensure your VMC Refresh Token is valid and try again"
break
@@ -2924,4 +2924,4 @@ Function Remove-NSXTNatRule {
Write-Host "Successfully deleted NAT Rule $Name"
}
}
}
}