How to connect / authenticate Rest API with Client ID and Client Secret?

Hi everyone,
I have never worked with this kind of API before, and could need some help. I have the following information regarding the Rest API access:

"
Authentication will be completed through the use of access tokens. Users will be provided a Client ID and a Client Secret to access data.
We will provide users with two reference clients, one to connect to the rest API and one to connect to the websocket. The user will have to enter their client ID and secret in the reference client and the code will handle getting the access token. The reference clients also handle putting the access token in the Authorization header for the request.

Client ID = 123
Client Secret = abc

Hostnames:
Rest API - https://api.secondspectrum.com
WebSocket - wss://live-v2.secondspectrum.com

Let's say I want this endpoint:
Schedule - Get a list of games for a competition

GET /schedule/ssi?competitionId={SecondSpectrumLeagueId}&season={year}

They have this example in their documentation:

curl
‘${HOST}/schedule/ssi?competitionId=123?sea
son=2023’

I dont know where to start - how do I authenticate and get an access token?

Hi @Speed27 ,

under OAuth • httr2 and OAuth • httr2 you will find a detailed account on how to proceed.

If you hit an obstacle - just post the issue here.

Thanks @vedoa

So far I have done this code:

library(httr2)

client <- oauth_client(
id = "123",
token_url = "https://api.secondspectrum.com",
name = "Second S Test"
)

client <- oauth_client(
id = "123",
secret = obfuscated("abc"),
token_url = "https://api.secondspectrum.com",
name = "Second S Test"
)

github_client <- function() {
oauth_client(
id = "123",
secret = obfuscated("abc"),
token_url = "https://api.secondspectrum.com",
name = "Second S Test"
)
}

In secret = obfuscated() I have put in my Client Secret, I dont know if this is correct, or I should run obfuscated("secret"), and put in whatever it gives me that way instead?

Also next step about creating a token with "oauth_flow_auth_code", I dont know what to put in in auth_url, as I have only got this api hostname in the documentation: https://api.secondspectrum.com.

Can you help with next step?

According to tracking-reference-client-v2/bash/auth.sh at main · secondspectrum/tracking-reference-client-v2 · GitHub

the full configuration could be found under

https://secondspectrum.auth0.com/.well-known/openid-configuration

So try some of the urls there (like "token_endpoint": "https://secondspectrum.auth0.com/oauth/token")