@twurple/auth-electron
TypeScript icon, indicating that this package has built-in type declarations

6.2.1 • Public • Published

Twurple - Electron auth provider

GitHub license npm version PRs welcome

This is an {@link AuthProvider} implementation for the twurple package family that will automatically pop up a Twitch OAuth dialog in an Electron BrowserWindow as soon as new scopes are requested.

Installation

To add this library to your project, just execute:

yarn add @twurple/auth-electron

or using npm:

npm install @twurple/auth-electron

Basic usage

To instantiate an {@link ApiClient} with this auth provider, just pass it to its constructor:

import { ApiClient } from '@twurple/api';
import { ElectronAuthProvider } from '@twurple/auth-electron';

const clientId = 'abc123';
const redirectUri = 'http://foo.bar/login';

const authProvider = new ElectronAuthProvider({
	clientId,
	redirectUri
});

const client = new ApiClient({
	authProvider
});

Please note that this currently only works from the main thread.

To allow the user to "log out" and change to another account, use:

authProvider.allowUserChange();

If you're getting stuck...

You can join the Twitch API Libraries Discord Server and ask in #twurple for support.

Package Sidebar

Install

npm i @twurple/auth-electron

Weekly Downloads

0

Version

6.2.1

License

MIT

Unpacked Size

19.7 kB

Total Files

18

Last publish

Collaborators

  • d-fischer