I have the original curl call which is said to be working in a Unix environment (or whatever they use at the provider's office).
curl
-u ybeepbeepbeepa:eboopboopboopa
-k
-d "grant_type=mobile&customerId=SE.B2C/abcd&pin=1234&scope=openid"
-H "Content-Type:application/x-www-form-urlencoded"
https://xxx/oauth2/token
Using the docs for curl I exchanged the flags and attributes to the following.
Invoke-WebRequest
-User ybeepbeepbeepa:eboopboopboopa
-Method POST
-Headers @{"Content-Type"="application/x-www-form-urlencoded"}
-Uri "https://xxx/oauth2/token?grant_type=mobile&customerId=SE.B2C/abcd&pin=1234&scope=openid"
The only part which I failed to translate is -k, which is supposed to be equivalent to --insecure. Checking said docs, I arrived at a few possible, though far-fetched, alternatives (such as -AllowUnencryptedAuthentication) but all of them failed and I'm out of ideas.
- What is the equivalent of curl's --insecure (or -k) in PowerShell's Invoke-WebRequest (which accidentally is assed to curl, which is confusing as duck since the flags differ)?
- Is the rest of the command properly ported to PowerShell? (I've contracted some flags and baked them together with the URL as querty string. And I'm not entirely certain of the syntax for Headers.)