@rlanz/ally-twitch
Version:
<p align="center"> <img src="https://github.com/RomainLanz/ally-twitch/assets/2793951/d3ccf29b-6169-4563-b932-5b15258a7fa3" alt="@rlanz/ally-twitch"> </p
103 lines (102 loc) • 3.06 kB
TypeScript
/**
* @rlanz/ally-twitch
*
* @license MIT
* @copyright Romain Lanz <romain.lanz@pm.me>
*/
import { Oauth2Driver } from '@adonisjs/ally';
import type { HttpContext } from '@adonisjs/core/http';
import type { ApiRequestContract, RedirectRequestContract } from '@adonisjs/ally/types';
import type { TwitchDriverConfig, TwitchScopes, TwitchToken } from './types/main.js';
export declare class TwitchDriver extends Oauth2Driver<TwitchToken, TwitchScopes> {
config: TwitchDriverConfig;
/**
* The URL to hit to exchange the authorization code for the access token
*/
protected accessTokenUrl: string;
/**
* The URL for the redirect request. The user will be redirected on this page
* to authorize the request.
*/
protected authorizeUrl: string;
/**
* The URL to hit to get the user details
*/
protected userInfoUrl: string;
/**
* The param name for the authorization code
*/
protected codeParamName: string;
/**
* The param name for the error
*/
protected errorParamName: string;
/**
* Cookie name for storing the "twitch_oauth_state"
*/
protected stateCookieName: string;
/**
* Parameter name to be used for sending and receiving the state
* from Twitch
*/
protected stateParamName: string;
/**
* Parameter name for defining the scopes
*/
protected scopeParamName: string;
/**
* Scopes separator
*/
protected scopesSeparator: string;
constructor(ctx: HttpContext, config: TwitchDriverConfig);
protected configureRedirectRequest(request: RedirectRequestContract<TwitchScopes>): void;
/**
* Returns the HTTP request with the authorization header set
*/
protected getAuthenticatedRequest(url: string, token: string): import("@adonisjs/ally").ApiRequest;
/**
* Fetches the user info from the Twitch API
*/
protected getUserInfo(token: string, callback?: (request: ApiRequestContract) => void): Promise<{
id: any;
nickName: any;
name: any;
email: any;
emailVerificationState: "unsupported";
avatarUrl: any;
original: any;
}>;
/**
* Find if the current error code is for access denied
*/
accessDenied(): boolean;
/**
* Returns details for the authorized user
*/
user(callback?: (request: ApiRequestContract) => void): Promise<{
token: TwitchToken;
id: any;
nickName: any;
name: any;
email: any;
emailVerificationState: "unsupported";
avatarUrl: any;
original: any;
}>;
/**
* Finds the user by the access token
*/
userFromToken(token: string, callback?: (request: ApiRequestContract) => void): Promise<{
token: {
token: string;
type: "bearer";
};
id: any;
nickName: any;
name: any;
email: any;
emailVerificationState: "unsupported";
avatarUrl: any;
original: any;
}>;
}