Submitting a Move for the Player via REST/Socket.IO

Hello,

I’ve been working on a client for OGS as a study project. However I am finding the documentation on both the real-time API and REST api lacklustre. To start, I am aware of and have read the documentation on both. So far I managed to have the client authenticate (via REST) and connect to a live game (via Socket.io).

The problem is I am unable to submit a move on behalf of the player logged in. Trying to do so via REST generates a server error 500 (internal server error). So I tried to accomplish that through socket.io, which, according to the docs, requires an auth token that is supposedly provided by REST. At first I assumed it’s the OAuth2 token obtained upon authorization, but that doesn’t seem to work. Nowhere in either docs mentions another way to obtain auth tokens for a user’s game.

A quick ping to @matburt since anoek said you’re the guru on that subject. Any help is appreciated :slight_smile:

Edit: I had a look over OgsDroid’s source code and found many undocumented socket.io endpoints, including a vital one known as “authenticate”. As a suggestion I highly recommend the developers to update & complete the API docs. There have been many discrepancies in endpoint links in the REST api as far as I am aware of as well.

Edit 2: Ah my poor English comprehension skills has allowed me to misinterpret a vital section on the API docs. The problem is solved :slight_smile:

Hi Kevin,

I went through this a few months ago and left some notes - not sure if they will be of any help to you ? OGS API notes

From a quick read of my notes, at a minimum you will need to use the REST authenticate call before you can push moves through the RT API; and you will need to use the login and config REST calls first to get the token that authenticate expects. But there may be more - my recollection is that the APIs can be fickle and fail in mysterious ways if you are missing some of the steps :confused: