Tiltify
For usage, see OAuth 2.0 provider.
import { Tiltify } from "arctic";
const tiltify = new Tiltify(clientId, clientSecret, redirectURI);
const url: URL = await tiltify.createAuthorizationURL(state, {
// optional
scopes
});
const tokens: TiltifyTokens = await tiltify.validateAuthorizationCode(code);
const tokens: TiltifyTokens = await tiltify.refreshAccessToken(refreshToken);
Get current user
Use the /api/public/current-use
endpoint without passing any arguments.
const tokens = await twitch.validateAuthorizationCode(code);
const response = await fetch("https://v5api.tiltify.com/api/public/current-user", {
headers: {
Authorization: `Bearer ${tokens.accessToken}`,
"Client-Id": clientId
}
});
const user = await response.json();