Not a direct answer because I’ve never done this from scratch and don’t know how it works, but you could perhaps look at the gtp2ogs github code and see how it does authentication. Perhaps that will shed some light.
Tested and works for me on beta and prod, so go here first to register a client:
as an example I chose client type public and grant type password
After you’ve done that, you’ll want to make sure the account you want to login as has a password set, here’s a curl example:
curl -X POST -d 'grant_type=password&username=matburt&password=notmypass&client_id=clientidgivenonthatpage&client_secret=clientsecretgivenonthatpage' https://online-go.com/oauth2/token/
Alternatively you can do this:
curl -X POST -d 'grant_type=password&username=matburt&password=notmypass' -u "clientidgivenonthatpage:clientsecretgivenonthatpage" https://online-go.com/oauth2/token/
I’ll point out that if your password contains something that your environment doesn’t like then that could interfere with the authentication… for example, using the curl line above verbatim is going to have trouble if your password contains an ampersand & or a bang ! and needs to be encoded appropriately.
The command doesn’t work for me. Using https returns “error”: “invalid_client” but using http returns empty string. When I copy the request to postman it says 405 error. I created the API client from this site: Play Go at online-go.com! | OGS