
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
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 1 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.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.