Fixing the authorize request to use the recently updated API change. Refresh tokens visa the query param were deprecated.

https://console.cloud.vmware.com/csp/gateway/am/api/swagger-ui.html#/Authentication/getAccessTokenByApiRefreshTokenUsingPOST
This commit is contained in:
Akeem Jenkins
2019-11-12 13:46:23 -07:00
parent ffe7d86921
commit c7fcb1b186

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
@@ -2896,4 +2896,4 @@ Function Remove-NSXTNatRule {
Write-Host "Successfully deleted NAT Rule $Name"
}
}
}
}