faceit-visa
Version:
A lightweight OAuth2 authentication library for FACEIT integration
57 lines • 1.52 kB
TypeScript
export interface FaceitVisaConfig {
clientId: string;
clientSecret: string;
redirectUri: string;
apiEnv?: string;
accountEnv?: string;
}
export interface FaceitUser {
user_id: string;
player_id: string;
nickname: string;
email?: string;
avatar: string;
country: string;
level?: number;
[key: string]: any;
}
export interface TokenResponse {
access_token: string;
token_type: string;
expires_in: number;
refresh_token?: string;
scope?: string;
}
export declare class FaceitVisa {
private config;
private codeVerifierStore;
constructor(config: FaceitVisaConfig);
/**
* Generate authorization URL for OAuth2 flow
*/
getAuthUrl(sessionId?: string): {
url: string;
codeVerifier: string;
};
/**
* Exchange authorization code for access token
*/
exchangeCode(code: string, codeVerifier: string): Promise<TokenResponse | null>;
/**
* Get user profile using access token
*/
getUserProfile(accessToken: string): Promise<FaceitUser | null>;
/**
* Get code verifier by session ID
*/
getCodeVerifier(sessionId: string): string | undefined;
/**
* Remove code verifier after use
*/
clearCodeVerifier(sessionId: string): void;
private base64URLEncode;
private base64Encode;
}
export { FaceitVisaMiddleware, AuthenticatedRequest, MiddlewareOptions } from './middleware';
export default FaceitVisa;
//# sourceMappingURL=index.d.ts.map