How can I get an oauth2 token?

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.

1 Like