![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
react-twitch-ext-onauthorized
Advanced tools
React hook handling authorization with Twitch Extensions JavaScript Helper
As of 15 March 2023 this project is no longer updated or maintained.
React hook performing authorization with Twitch Extensions JavaScript Helper. It calls twitch.ext.onAuthorized
and returns authorization object.
While onAuthorized
is not the only method offered by The Extensions JavaScript Helper, it is one of the most important building blocks of each Twitch Extension.
npm install --save react-twitch-ext-onauthorized
Example:
import { useTwitchAuth } from "react-twitch-ext-onauthorized";
const MyElement = () => {
const twitchAuth = useTwitchAuth();
return <div>TestElement {JSON.stringify(twitchAuth)}</div>;
};
When authorization succeeds, twitchAuth
contains the following properties:
{
authorized: true,
channelId: 'channel id goes here',
clientId: 'client id goes here',
token: 'token goes here',
userId: 'user id goes here',
}
When loaded outside of Twitch context, twitchAuth
properties contain empty strings and authorized
property will remain false
:
{
authorized: false,
channelId: '',
clientId: '',
token: '',
userId: '',
}
Note that you still have to provide Twitch JavaScript Helper yourself so that window.Twitch.ext
resolves correctly -- see Twitch docs on adding the Extension Helper.
react-twitch-ext-onauthorized
exposes two interfaces which can be used for type checking: TwitchAuthResponse
and TwitchAuthObject
.
To import them into your project add
import { TwitchAuthResponse } from "react-twitch-ext-onauthorized";
// OR
import { TwitchAuthObject } from "react-twitch-ext-onauthorized";
TwitchAuthResponse
Represents the shape of authorization object received from Twitch.
interface TwitchAuthResponse {
channelId: string;
clientId: string;
token: string;
userId: string;
}
TwitchAuthObject
Contains Twitch authorization object (TwitchAuthResponse
) and a property authorized
which denotes whether authorization was successful:
interface TwitchAuthObject {
authorized: boolean;
channelId: string;
clientId: string;
token: string;
userId: string;
}
Contributions of any kind are welcome.
You can contribute to React-twitch-ext-onauthorized by:
Before contributing be sure to read Contributing Guidelines and Code of Conduct.
To all who contribute code, improve documentation, submit issues or feature requests - thank you for making Twitch-ebs-tools even better!
We maintain an AUTHORS file where we keep a list of all project contributors. Please consider adding your name there with your next PR.
Code is available under MIT license. See LICENSE for more information.
This project is not authored, affiliated or endorsed in any way by Twitch.tv.
FAQs
React hook handling authorization with Twitch Extensions JavaScript Helper
The npm package react-twitch-ext-onauthorized receives a total of 0 weekly downloads. As such, react-twitch-ext-onauthorized popularity was classified as not popular.
We found that react-twitch-ext-onauthorized 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
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.