0.2.4 • Published 9 months ago

@twapi/auth v0.2.4

Weekly downloads
-
License
ISC
Repository
-
Last release
9 months ago

@twapi/auth

This package is a basic twitch auth provider. This package is used by other twapi packages to authenticate.

Features

  • Automatically refreshes user access token
  • Fetches new app access token on expiration
  • Gets user id and user name from token

Documentation

Read our documentation for the auth package

Quickstart

1. Add the following dependency

pnpm add @twapi/auth

2. Create new Credentials

const credentials = new Credentials(
  oauthToken,
  clientId,
  clientSecret,
  refreshToken
);
// Refresh token is optional

3. Instantiate Auth Provider

const authProvider = new AuthProvider(credentials);

// Get user access token
console.log(await authProvider.getUserAccessToken());

// Get User Id or User name
console.log(await authProvider.getUserId());
// This is asynchronous as it waits for access token validation
0.2.4

9 months ago

0.2.3

9 months ago

0.2.2

9 months ago

0.2.1

9 months ago

0.2.0

9 months ago

0.1.0

9 months ago