Invoke-WebRequest : A parameter cannot be found that matches parameter name 'L'. At line:1 char:6
- curl -L -X POST 'https://www.googleapis.com/oauth2/v4/token?
-
~~- CategoryInfo : InvalidArgument: (:) [Invoke-WebRequest], ParameterBindingException
- FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
On Windows,
curlis an alias for PowerShell'sInvoke-WebRequestcmdlet, which can cause issues when running curl commands in a PowerShell prompt because the arguments for curl and the arguments forInvoke-WebRequestare not the same. It's an unfortunate historical decision that is somewhat tricky to remove because there may be many scripts relying on the behaviour.To resolve, you can either
PATHvariable, remove the PowerShell alias (rm alias:curl, you might want to add to your PowerShell profile), and run the command again withcurlor
Invoke-WebRequestwith the equivalent arguments, which would beThe
-Lcommand ofcurlis not needed forInvoke-WebRequestas it follows redirects by default (up to 5), but this can be increased with-MaximumRedirectionargument.