
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
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 6 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
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.