How to get access token?

I have my client ID. but How do I get the access token ? I remember it was a cURL command…

The Authentication docs have all the info you need on the various auth flows: https://dev.twitch.tv/docs/authentication

Which auth flow you need depends entire on your use case.

I only need for helix/streams. I dont find that there :confused:

Then you can just use an App Access Token, which is generated through the client credentials flow https://dev.twitch.tv/docs/authentication/getting-tokens-oauth#oauth-client-credentials-flow

I get 404 with this URL:

https://id.twitch.tv/oauth2/token?client_id=XXX&client_secret=XXX&grant_type=client_credentials

As documented you need to make a POST request, you did a GET request

1) On your server, get an app access token by making this request:

POST https://id.twitch.tv/oauth2/token
    ?client_id=<your client ID>
    &client_secret=<your client secret>
    &grant_type=client_credentials
    &scope=<space-separated list of scopes>
1 Like

thanks it worked. I Get:

expires_in":5032307

is this in seconds ? only 2 month ?

yes in seconds.

And yes around 60 days

You’ll then need to get a new token in the same way you got this first one

1 Like

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