1.3.0 • Published 3 months ago

remix-auth-twitch v1.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

Remix Auth Twitch

Demo app: https://remix-auth-twitch.pages.dev/

see also example/README.md

Remix Auth plugin for Twitch

Authentication | Twitch Developers

Supported runtimes

RuntimeHas Support
Node.js
Cloudflare

How to use

Installation

Install remix-auth-twitch npm module along with remix-auth:

npm install remix-auth-twitch remix-auth

yarn add remix-auth-twitch remix-auth

Prerequisites

Add remix project

See also na2hiro/remix-auth-twitter: Remix Auth plugin for Twitter OAuth 1.0a

const twitchClientId = process.env.TWITCH_API_CLIENT
const twitchClientSecret = process.env.TWITCH_API_SECRET
const twitchStrategy = new TwitchStrategy(
  {
    clientId: twitchClientId,
    clientSecret: twitchClientSecret,
    callbackURL: 'http://localhost:3000/login/callback',
    includeEmail: true,
  },
  async ({ profile, token }) => {
    return {
      id: profile.id,
      screen_name: profile.display_name,
      name: profile.login,
      email: profile.email,
      accessToken: token.access_token,
    }
  }
)
authenticator.use(twitchStrategy, 'twitch')

Validating Tokens | Twitch Developers

Any third-party app that calls the Twitch APIs and maintains an OAuth session must call the /validate endpoint to verify that the access token is still valid. This includes web apps, mobile apps, desktop apps, extensions, and chatbots. Your app must validate the OAuth token when it starts and on an hourly basis thereafter.

First Validation is build-in TwitchStrategy, but Your application must validate it on an hourly basis.

try {
  await twitchStrategy.validate({ token: accessToken })
} catch {
  authenticator.logout(request, { redirectTo: '/login' })
}

Related

1.3.0

3 months ago

1.2.3

12 months ago

1.2.0

12 months ago

1.2.2

12 months ago

1.1.0

2 years ago

1.0.5

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago