How should i get OAuth token


#1

Hello!
1-2 days ago i started my project and i have some issues with getting tokens. I dont uderstand some points in docs.

To get OAuth2 Token firstly i make a GET Request to
https://id.twitch.tv/oauth2/authorize?response_type=code&client_id=${clientId}&redirect_uri=${redirect}&scope=${scopesList.join('+')}&force_verify=true

User authorize and gets redirect to redirect_uri and later i get a “code” and i make a next POST request to:
https://id.twitch.tv/oauth2/token?client_id=${clientId}&client_secret=${clientSecret}&code=${code}&grant_type=authorization_code&redirect_uri=${redirect}

(with post request data)

and get json response
{
“access_token”: “token”,
“refresh_token”: “ref-token”,
“expires_in”: timeInSeconds,
“scope”: “scopes”,
“token_type”: “bearer”
}

it always return token_type bearer and expires_in (some around 15k seconds) but in other endpoints i have to specify authorization type OAuth or Bearer what should i pick ? In the beggining i trying to get oAuth but end with Bearer code.

My second ask is when v5 gonna be departed


#2

Helix uses Authorization: Bearer XXXX while Kraken use Authorization: OAuth XXXX as the header syntax.

The token does not matter as long as you are using the proper scopes and the syntax for each API.


#3

Thanks for help.
I have one more small ask about expires_in. In website like twitchtokengenerator.com u will get token and reftoken available for 60 days but i never gets more then 15k seconds. How they are fetching this keys ?


#4

Legacy ClientID