UNPKG

easy-social-auth

Version:

A flexible, standalone package for social authentication using Google, Facebook & Twitter

19 lines (18 loc) 1.31 kB
import { ISocialUser } from "../interfaces/social-user.interface"; import { GrantType } from "../enums/grant-type.enum"; import { SocialAuthResponse } from "../interfaces/easy-social-auth-response.interface"; export declare abstract class AuthStrategy { protected readonly clientId: string; protected readonly clientSecret: string; protected readonly userInfoEndpoint: string; protected readonly tokenEndpoint: string; protected readonly authUrl: string; protected readonly grantType: GrantType; constructor(clientId: string, clientSecret: string, userInfoEndpoint: string, tokenEndpoint: string, authUrl: string, grantType?: GrantType); generateAuthUrl(redirectUri: string, scope?: string, responseType?: string, additionalParams?: Record<string, string>): string; protected exchangeToken(params: Record<string, string>): Promise<SocialAuthResponse<string>>; exchangeCodeForToken(code: string, redirectUri: string, additionalParams?: Record<string, string>): Promise<SocialAuthResponse<string>>; refreshAccessToken(refreshToken: string): Promise<SocialAuthResponse<string>>; exchangePasswordForToken(username: string, password: string): Promise<SocialAuthResponse<string>>; abstract getUserData(accessToken: string): Promise<SocialAuthResponse<ISocialUser>>; }