remix-auth-vk
Version:
The VK strategy is used to authenticate users against a VK account. It extends the OAuth2Strategy.
67 lines (66 loc) • 2.17 kB
TypeScript
import type { StrategyVerifyCallback } from 'remix-auth';
import type { OAuth2Profile, OAuth2StrategyVerifyParams } from 'remix-auth-oauth2';
import { OAuth2Strategy } from 'remix-auth-oauth2';
export declare type VKAuthDialogDisplay = 'page' | 'popup' | 'mobile';
export declare type VKStrategyOptions = {
clientID: string;
clientSecret: string;
callbackURL: string;
/**
* @default "5.131"
*/
apiVersion?: string;
display?: VKAuthDialogDisplay;
/**
* @default "email"
* @example "friends,video,photos"
*/
scope?: string;
/**
* List of available user fields here https://dev.vk.com/method/users.get.
* */
userFields?: string[];
};
export declare type VKProfile = {
id: string;
displayName: string;
name: {
familyName: string;
givenName: string;
};
emails: {
value: string;
}[];
photos: {
value: string;
}[];
_json: {
response: ({
id: number;
photo_max_orig: string;
has_photo: 0 | 1;
screen_name: string;
first_name: string;
last_name: string;
can_access_closed: boolean;
is_closed: boolean;
} & Record<string, never>)[];
};
} & OAuth2Profile;
export declare type VKExtraParams = {
access_token: string;
email: string;
expires_in: number;
user_id: number;
} & Record<string, string | number>;
export declare class VKStrategy<User> extends OAuth2Strategy<User, VKProfile, VKExtraParams> {
name: string;
private readonly apiVersion;
private readonly display;
private readonly scope;
private readonly userFields;
private readonly userInfoURL;
constructor({ clientID, clientSecret, callbackURL, apiVersion, display, scope, userFields, }: VKStrategyOptions, verify: StrategyVerifyCallback<User, OAuth2StrategyVerifyParams<VKProfile, VKExtraParams>>);
protected authorizationParams(): URLSearchParams;
protected userProfile(accessToken: string, extraParams: VKExtraParams): Promise<VKProfile>;
}