Hi all. I’m trying to write my own client for my bot, in order to allow it to play demos on OGS (my bot relays games).
I’m now struggling with the authentication phase, and after trying a lot of different method, including the one mentioned in the API documentation, I found this one almost working (mixing API and external documentation)
Dim request As WebRequest = WebRequest.Create("https://online-go.com/oauth2/token")
request.Method = "POST"
request.ContentType = "application/x-www-form-urlencoded"
Dim DataString As StringBuilder = New StringBuilder
DataString.Append("client_id=etcetera")
Dim Postdata() As Byte = System.Text.Encoding.Default.GetBytes(DataString.ToString())
request.ContentLength = Postdata.Length
Dim tempStream As Stream = request.GetRequestStream()
tempStream.Write(Postdata, 0, Postdata.Length)
tempStream.Close()
Dim responseContent As String
Dim response As WebResponse = request.GetResponse
Dim reader = New System.IO.StreamReader(response.GetResponseStream())
responseContent = reader.ReadToEnd()
All lines are logical: I send the authentication request using the “POST” method, then I should get the response (the token) with the “dim response as webResponse = request.getResponse” line; this response is linked to my original request, so it must be this way.
But the server answers with a 405 error (“method not supported”).
cURL works perfectly, by the way, and it uses the same parameters.
I’ don’t know what else to do.