Built-in REST Client with .http files with Content-type: application/x-www-form-urlencoded

Salah 0 Reputation points
2024-06-04T09:10:11.5266667+00:00

Hi guys,

I'm using .https request in VS 2022 v17.10.0 to test my APIs. It's pretty awesome feature, but I didn't find enaught documentation.

Before I can call my API I need to get a token.

POST {{myIdentityServerUrl}}/connect/token HTTP/1.1
Content-type: application/x-www-form-urlencoded

grant_type=password
&scope=myapp:read myapp:write
&client_id=myapp-test-client
&client_secret={{clientSecret}}
&username={{username}}
&password={{password}}


I keep having this error : error 400 Bad Request { "error": "invalid_client" }.

The same call works perfectly from vscode using RestClient extention.

I even replaced the varibales with values, but without aby success.

Is there any documentation or help for this kind of use case.

Thanks

Developer technologies Visual Studio Other
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.