Hi,
I am trying to set the authentication method for a collection. The method is Oauth2 with Password credentials. I am able to get the token with a simple request, but not when try to set the collection’s authentication.
Here’s the log with error:
POST /api/externalServices/login HTTP/1.1
Content-Type: application/x-www-form-urlencoded
User-Agent: PostmanRuntime/7.29.0
Accept: */*
Cache-Control: no-cache
Postman-Token: 8302e858-113e-489a-a477-fa4336e99c77
Host: api.retelogisticastorage.it
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Length: 87
grant_type=password&username=xxxxxx&password=xxxxxx&client_id=&client_secret=
HTTP/1.1 415 Unsupported Media Type
Server: nginx
Date: Thu, 28 Apr 2022 10:09:36 GMT
Content-Length: 0
Here is the log of the simple request:
POST /api/externalServices/login HTTP/1.1
Content-Type: application/json
User-Agent: PostmanRuntime/7.29.0
Accept: */*
Postman-Token: 52497d11-be4c-4edd-ac9c-cbef2dd81304
Host: api.retelogisticastorage.it
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Length: 128
{
grant_type: "password",
username: "xxxxxx",
password: "xxxxxx",
client_id: "",
client_secret: ""
}
HTTP/1.1 200 OK
Transfer-Encoding: chunked
Content-Type: application/json; charset=utf-8
Content-Encoding: br
Server: nginx
X-Powered-By: PleskLin
Date: Thu, 28 Apr 2022 10:14:14 GMT
{
"authToken": "<omissis>",
"username": "Riparaora"
}
It appears to me that the credentials are sent as query string instead of body, although I selected the “Send client credential in body” as option. See attachment.
Am I doing something wrong?
To be noted: url, username and password use the same variables.