
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
twitch-api-typescript
Advanced tools
Fully typed TwitchAPI wrapper that makes working with TwitchAPI as easy as possible
Fully typed TwitchAPI wrapper that makes working with TwitchAPI as easy as possible

# With npm:
npm install twitch-api-typescript
#With yarn:
#Not added yet
TwitchTS always tries to use the user access token first for API calls that can be called using the app access token or user access token. So if you know that you only make calls where the app access token is enough, then it is enough to just specify that.
During initialization, several pieces of optional information can be specified for token management:
const apiClient = new TwitchAPI({
clientId: "{YOUR-CLIENT-ID}",
tokens:{
userToken: "{YOUR-USER-ACCESS-TOKEN}",
appToken: "{YOUR-APP-ACCESS-TOKEN}"
}
})
await apiClient.init();
const apiClient = new TwitchAPI({
clientId: "{YOUR-CLIENT-ID}",
tokens:{
refreshToken: "{YOUR-REFRESH-TOKEN}"
}
})
await apiClient.init();
const apiClient = new TwitchAPI({
clientId: "{YOUR-CLIENT-ID}",
clientSecret: "{YOUR-CLIENT-SECRET}"
})
await apiClient.init();
At runtime, all settings related to tokens can be changed. TwitchTS offers a public interface for this purpose:
const apiClient = new TwitchAPI({
clientId: "{YOUR-CLIENT-ID}",
...
})
//Setting tokens/secret to a new value directly.
apiClient._tokenHandler.userAccessToken = "{NEW-USER-ACCESS-TOKEN}"
apiClient._tokenHandler.appAccessToken = "{NEW-APP-ACCESS-TOKEN}"
apiClient._tokenHandler.refreshToken = "{NEW-REFRESH-TOKEN}"
apiClient._tokenHandler.clientSecret = "{NEW-CLIENT-SECRET}"
//Manually trigger a refresh of the respective token
await apiClient._tokenHandler.renewAppAccessToken();
await apiClient._tokenHandler.renewUserAccessToken();
//Stop the refresh interval of the respective token refresh routine
await apiClient._tokenHandler.stopAppTokenRefresh();
await apiClient._tokenHandler.stopUserTokenRefresh();
//Start/Restart the refresh interval of the respective token refresh routine
await apiClient._tokenHandler.startAppTokenRefresh();
await apiClient._tokenHandler.stopUserTokenRefresh();
Copyright © 2022 François Egner.
This project is GNU General Public License v3.0 licensed.
FAQs
Fully typed TwitchAPI wrapper that makes working with TwitchAPI as easy as possible
The npm package twitch-api-typescript receives a total of 0 weekly downloads. As such, twitch-api-typescript popularity was classified as not popular.
We found that twitch-api-typescript demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.