@peacockproject/core
Version:
Type definitions for Peacock's core.
29 lines (28 loc) • 954 B
TypeScript
import type { RequestWithJwt } from "./types/types";
export declare const JWT_SECRET: string;
export type OAuthTokenBody = {
grant_type: "external_steam" | "external_epic" | "refresh_token";
steam_userid?: string;
epic_userid?: string;
access_token: string;
pId?: string;
locale: string;
rgn: string;
gs: string;
steam_appid: string;
};
export type OAuthTokenResponse = {
access_token: string;
token_type: "bearer" | string;
expires_in: number;
refresh_token: string;
};
export declare const error400: unique symbol;
export declare const error406: unique symbol;
/**
* This is the code that handles the OAuth token request.
* We cannot do this without a request object because of the refresh token use case.
*
* @param req The request object.
*/
export declare function handleOAuthToken(req: RequestWithJwt<never, OAuthTokenBody>): Promise<typeof error400 | typeof error406 | OAuthTokenResponse>;