
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
A community-centric, community-supported Twitch JavaScript SDK.
Here are the planned features. If you feel something is missing, create an issue or submit a PR against the next branch.
If you are using a module bundler, such as Webpack, Browserify, or a in a Node environment:
Add TwitchJS to your project:
npm install --save twitch-js
Import TwitchJS
// ES2015 syntax
import TwitchJs from 'twitch-js'
// OR ES5 syntax
var TwitchJs = require('twitch-js')
const twitchJs = new TwitchJs({ username, token })
If you are not using a module bundler, precompiled builds are available in the
dist folder:
<script src="//unpkg.com/twitch-js@>2.0.0-beta.31"></script>
<script type="javascript">
const twitchJs = new window.TwitchJs({ username, token })
</script>
To obtain a client ID, follow the instructions found in the Twitch Developers documentation.
With a client ID, tokens may be generated on behalf of your users.
To quickly get started without a client ID, you may generate token using the following, community-maintained, sites:
To help with refreshing tokens, an onAuthenticationFailure function may be
provided to the Messaging and API clients. onAuthenticationFailure() must
return a Promise that resolves with the refreshed token. Upon resolution, any
actions that yielded an expired token response will be retried with the new,
refreshed token.
// Optionally, use fetchUtil to help.
import fetchUtil from 'twitch-js/lib/utils/fetch'
const refreshToken = 'eyJfaWQmNzMtNGCJ9%6VFV5LNrZFUj8oU231/3Aj'
const clientId = 'fooid'
const secret = 'barbazsecret'
const onAuthenticationFailure = () =>
fetchUtil('https://id.twitch.tv/oauth2/token', {
method: 'post',
search: {
grant_type: 'refresh_token',
refresh_token: refreshToken,
client_id: clientId,
client_secret: clientSecret,
},
}).then((response) => response.accessToken)
const token = 'cfabdegwdoklmawdzdo98xt2fo512y'
const username = 'ronni'
const twitchJs = new TwitchJs({ token, username, onAuthenticationFailure })
twitchJs.chat.connect().then((globalUserState) => {
// Do stuff ...
})
See Refreshing access tokens for more information.
See the Twitch Developers documentation for more information on authentication.
Examples are provided via CodeSandbox:
If you wish to contribute, please see the CONTRIBUTING doc.
Schmoopiie and all the
original contributors of
tmi.js.
MIT
TwitchJS is not affiliated, associated, authorized, endorsed by, or in any way officially connected with Twitch, or any of its subsidiaries or its affiliates. The name "Twitch" as well as related names, marks, emblems and images are registered trademarks of Twitch.
FAQs
Javascript library for the Twitch Messaging Interface.
The npm package twitch-js receives a total of 490 weekly downloads. As such, twitch-js popularity was classified as not popular.
We found that twitch-js 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.