Search code examples
c#ucwa

UCWA grant_Type password returns 400 Bad Request


I have an application that use grant_type=password as oauth method.

The request looks like:

Request

POST https://myLync.mydomain.com/WebTicket/oauthtoken HTTP/1.1
Content-Type: application/x-www-form-urlencoded; charset=utf-8
Content-Length: 61

grant_type=password&username=usr@domain.invalid&password=pass

This will result in a 400 Bad Request response, with a body telling me:

Response

HTTP/1.1 400 Bad Request
Cache-Control: no-store
Pragma: no-cache
Content-Type: application/json
X-Ms-diagnostics: 28020;source="sfb-fe.mydomain.com";reason="No valid security token."
X-MS-Server-Fqdn: sfb-fe.mydomain.com
X-MS-Correlation-Id: 2147484275
client-request-id: f623a18b-c1d1-476f-9e58-f9745322b3e5
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
Content-Length: 25
Connection: close

{"error":"invalid_grant"}

I have searched for hours now, and I can't find anything that can give me a hint to a solution.

Anyone stumbled into the same issue, and maybe have a solution on this? "No valid security token" doesn't tell me much unfortunately.


Solution

  • I had the same problem. The problem was with the username, and when i changed the domain name it worked