OneGraph / onegraph-changelog

Product Changelog for OneGraph using Persisted Queries

Home Page:https://onegraph.com/changelog

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TwitchTV support for OneGraph auth!

sgrove opened this issue · comments

We just implemented the TwitchTV support for our onegraph-auth library, so you can easily have a user sign in with Twitch!

TwitchTV Auth support in OneGraph

To log in a user to your app with Twitch, you can use the following JavaScript:

import OneGraphAuth from 'onegraph-auth';

const auth = new OneGraphAuth({
  appId: APP_ID,
});

await auth.login('twitch-tv');
const isLoggedIn = await auth.isLoggedIn('twitch-tv');

if (isLoggedIn) {
  console.log("Successfully logged into Twitch!")
} else {
  console.log("User didn't log into Twitch")
}

Passthrough support

Another feature we've started adding to integrations is the concept of 'passthrough' fields, where you can make REST calls for any part of an API we haven't covered yet.

For example, to get a list of the top games on Twitch right now, you can simply run this query:

query TopGamesOnTwitchQuery {
  twitchTv {
    makeRestCall {
      get(path: "/kraken/games/top") {
        jsonBody
        response {
          headers
          statusCode
        }
      }
    }
  }
}

You can use that to hit any existing REST API endpoint you need.

And it's not simply a passthrough either! Twitch has changed how they do authentication between their v5 (kraken) and v6 (helix). Based on the endpoint you hit, we'll automatically choose the correct implementation so you don't need to worry about it!