Summary
Trying to obtain OAuth token from Mattermost, I get 400 Bad Request
Steps to reproduce
I have successfully sent a GET request to /oauth/authorize with response_type=code, client_id, redirect_url. Mattermost has called me back at the redirect_url, and sent a code in its GET request.
Then I POSTed to /oauth/authorize with a json object, but received a 400 Bad Request instead of the token information I expected. See log below.
Expected behavior
See above
Observed behavior
Sent -> Method: POST, RequestUri: 'http://ubuntu:8065/oauth/authorize', Version: 2.0, Content: System.Net.Http.StringContent, Headers:
{
Authorization: Bearer (removed)
Accept: application/json
Accept: text/html
Accept: */*
User-Agent: XR
User-Agent: Mattermost
User-Agent: Tool
Content-Type: application/json; charset=utf-8
}:{
"grant_type": "authorization_code",
"client_id": "(removed)",
"redirect_uri": "http://localhost:9998/",
"client_secret": "(removed)",
"code": "(removed)"
}
The response was thus:
Received -> StatusCode: 400, ReasonPhrase: 'Bad Request', Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContent, Headers:
{
X-Request-ID: tjpnqwkuyb8ffe3cxk35ydydsr
X-Version-Id: 5.11.0.5.11.0.368dcfca505c267d13c6d7f53aaceb93.false
Date: Thu, 27 Jun 2019 16:30:36 GMT
Content-Type: text/html
Content-Length: 614
}