Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
@callowcreation/basic-twitch-oauth
Advanced tools
Intended to reduce the expected prerequisite experience required for implementing Twitch OAuth to use the Twitch API(s)
Intended to reduce the expected prerequisite experience required for implementing Twitch OAuth to use the Twitch API(s)
The statements below are still a bit beyond your experiences and you need/want to use a Twitch API… is my motivation.
Twitch API(s) now require that some endpoint request must have an authorization in the header. To acquire an access token for a Twitch API you must be familiar with an authentication flow. The flows supported by Twitch are Implicit code, authorization code, and client credentials.
See Twitch Authentication Docs
Required reading Getting Started with the Twitch API
$ npm install @callowcreation/basic-twitch-oauth
A Node server is required, express is used here.
const express = require('express');
const crypto = require('crypto');
const qs = require('querystring');
const app = express();
const buffer = crypto.randomBytes(16);
const state = buffer.toString('hex');
const twitchOAuth = new TwitchOAuth({
client_id: process.env.CLIENT_ID,
client_secret: process.env.CLIENT_SECRET,
redirect_uri: process.env.REDIRECT_URI,
scopes: [
'user:edit:broadcast',
'moderation:read'
]
}, state);
// redirect_uri ends up here
app.get('/auth-callback', async (req, res) => {
const qs = require('querystring');
const req_data = qs.parse(req.url.split('?')[1]);
const code = req_data['code'];
const state = req_data['state'];
try {
twitchOAuth.confirmState(state);
await twitchOAuth.fetchToken(code);
res.redirect('/home');
} catch (err) {
console.error(err);
res.redirect('/failed');
}
});
app.get('/extensions', async (req, res) => {
const url: string = `https://api.twitch.tv/helix/users/extensions?user_id=${broadcaster_id}`;
const json = await twitchOAuth.getEndpoint(url);
res.status(200).json(json);
});
try {
const url: string = `https://api.twitch.tv/helix/moderation/enforcements/status?broadcaster_id=${broadcaster_id}`;
const data = [
{ msg_id: '0', msg_text: 'I killing this', user_id: '101223367' },
{ msg_id: '1', msg_text: 'that was a death blow', user_id: '75987197' }
];
const json = await twitchOAuth.postEndpoint(url, { data });
res.status(200).json(json);
} catch (error) {
console.error(error);
res.send(error_message);
}
MIT
FAQs
Intended to reduce the expected prerequisite experience required for implementing Twitch OAuth to use the Twitch API(s)
The npm package @callowcreation/basic-twitch-oauth receives a total of 0 weekly downloads. As such, @callowcreation/basic-twitch-oauth popularity was classified as not popular.
We found that @callowcreation/basic-twitch-oauth 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
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.