No expires_in field in response while getting access token

Hi!
I noticed, that “expires_in” field is not returned now, though it is mentioned in documentation (https://dev.twitch.tv/docs/v5/guides/authentication/).
Is it a required field in a response? I know that access tokens do not expire now, but sometimes I see responses with “expires_in” == 0.
Could anyone explain such behavior?

Thank you!

1 Like

Anybody, please help!
Why is expires_in not returned now?

Are you sure you are not accidentally requesting refresh tokens?

I make a request to:
https://api.twitch.tv/kraken/oauth2/token
with params:

    {
        'code': '***',
        'client_secret': '***', 
        'redirect_uri': 'https://***', 
        'client_id': '***', 
        'grant_type': 'authorization_code'
    }

and headers:

    {
        'Content-Type': 'application/x-www-form-urlencoded', 
        'Accept': '*/*', 
        'User-Agent': '***'
    }

And I get response with response code == 200 and with content:

    {
        'access_token': '***',
        'scope': ['user_read', 'viewing_activity_read'],
        'refresh_token': '***'
    }

Though in the documentation in section OAuth Authorization Code flow example of response is:

{
   "access_token": "<user access token>",
   "refresh_token": "<refresh token>",
   "expires_in": <number of seconds until the token expires>,
   "scope": <your previously listed scope(s)>
}

Can anybody help please?

You will only receive expires_in if the token is actually set to expire. All of our tokens don’t expire at this time, which is why you’re missing it.

1 Like

With it being in the documentation that it’s supposed to expire, will the tokens soon be made to expire? If so, is there a timeline as to when that change will take place?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.