better-auth
Version:
The most comprehensive authentication library for TypeScript.
1,636 lines (1,618 loc) • 127 kB
TypeScript
import { L as LiteralString } from './better-auth.DTtXpZYr.js';
import * as z from 'zod/v4';
interface OAuth2Tokens {
tokenType?: string;
accessToken?: string;
refreshToken?: string;
accessTokenExpiresAt?: Date;
refreshTokenExpiresAt?: Date;
scopes?: string[];
idToken?: string;
}
type OAuth2UserInfo = {
id: string | number;
name?: string;
email?: string | null;
image?: string;
emailVerified: boolean;
};
interface OAuthProvider<T extends Record<string, any> = Record<string, any>, O extends Record<string, any> = Partial<ProviderOptions>> {
id: LiteralString;
createAuthorizationURL: (data: {
state: string;
codeVerifier: string;
scopes?: string[];
redirectURI: string;
display?: string;
loginHint?: string;
}) => Promise<URL> | URL;
name: string;
validateAuthorizationCode: (data: {
code: string;
redirectURI: string;
codeVerifier?: string;
deviceId?: string;
}) => Promise<OAuth2Tokens>;
getUserInfo: (token: OAuth2Tokens & {
/**
* The user object from the provider
* This is only available for some providers like Apple
*/
user?: {
name?: {
firstName?: string;
lastName?: string;
};
email?: string;
};
}) => Promise<{
user: OAuth2UserInfo;
data: T;
} | null>;
/**
* Custom function to refresh a token
*/
refreshAccessToken?: (refreshToken: string) => Promise<OAuth2Tokens>;
revokeToken?: (token: string) => Promise<void>;
/**
* Verify the id token
* @param token - The id token
* @param nonce - The nonce
* @returns True if the id token is valid, false otherwise
*/
verifyIdToken?: (token: string, nonce?: string) => Promise<boolean>;
/**
* Disable implicit sign up for new users. When set to true for the provider,
* sign-in need to be called with with requestSignUp as true to create new users.
*/
disableImplicitSignUp?: boolean;
/**
* Disable sign up for new users.
*/
disableSignUp?: boolean;
/**
* Options for the provider
*/
options?: O;
}
type ProviderOptions<Profile extends Record<string, any> = any> = {
/**
* The client ID of your application
*/
clientId: string;
/**
* The client secret of your application
*/
clientSecret?: string;
/**
* The scopes you want to request from the provider
*/
scope?: string[];
/**
* Remove default scopes of the provider
*/
disableDefaultScope?: boolean;
/**
* The redirect URL for your application. This is where the provider will
* redirect the user after the sign in process. Make sure this URL is
* whitelisted in the provider's dashboard.
*/
redirectURI?: string;
/**
* The client key of your application
* Tiktok Social Provider uses this field instead of clientId
*/
clientKey?: string;
/**
* Disable provider from allowing users to sign in
* with this provider with an id token sent from the
* client.
*/
disableIdTokenSignIn?: boolean;
/**
* verifyIdToken function to verify the id token
*/
verifyIdToken?: (token: string, nonce?: string) => Promise<boolean>;
/**
* Custom function to get user info from the provider
*/
getUserInfo?: (token: OAuth2Tokens) => Promise<{
user: {
id: string;
name?: string;
email?: string | null;
image?: string;
emailVerified: boolean;
[key: string]: any;
};
data: any;
}>;
/**
* Custom function to refresh a token
*/
refreshAccessToken?: (refreshToken: string) => Promise<OAuth2Tokens>;
/**
* Custom function to map the provider profile to a
* user.
*/
mapProfileToUser?: (profile: Profile) => {
id?: string;
name?: string;
email?: string | null;
image?: string;
emailVerified?: boolean;
[key: string]: any;
} | Promise<{
id?: string;
name?: string;
email?: string | null;
image?: string;
emailVerified?: boolean;
[key: string]: any;
}>;
/**
* Disable implicit sign up for new users. When set to true for the provider,
* sign-in need to be called with with requestSignUp as true to create new users.
*/
disableImplicitSignUp?: boolean;
/**
* Disable sign up for new users.
*/
disableSignUp?: boolean;
/**
* The prompt to use for the authorization code request
*/
prompt?: "select_account" | "consent" | "login" | "none" | "select_account consent";
/**
* The response mode to use for the authorization code request
*/
responseMode?: "query" | "form_post";
/**
* If enabled, the user info will be overridden with the provider user info
* This is useful if you want to use the provider user info to update the user info
*
* @default false
*/
overrideUserInfoOnSignIn?: boolean;
};
interface PayPalProfile {
user_id: string;
name: string;
given_name: string;
family_name: string;
middle_name?: string;
picture?: string;
email: string;
email_verified: boolean;
gender?: string;
birthdate?: string;
zoneinfo?: string;
locale?: string;
phone_number?: string;
address?: {
street_address?: string;
locality?: string;
region?: string;
postal_code?: string;
country?: string;
};
verified_account?: boolean;
account_type?: string;
age_range?: string;
payer_id?: string;
}
interface PayPalTokenResponse {
scope?: string;
access_token: string;
refresh_token?: string;
token_type: "Bearer";
id_token?: string;
expires_in: number;
nonce?: string;
}
interface PayPalOptions extends ProviderOptions<PayPalProfile> {
/**
* PayPal environment - 'sandbox' for testing, 'live' for production
* @default 'sandbox'
*/
environment?: "sandbox" | "live";
/**
* Whether to request shipping address information
* @default false
*/
requestShippingAddress?: boolean;
}
declare const paypal: (options: PayPalOptions) => {
id: "paypal";
name: string;
createAuthorizationURL({ state, codeVerifier, redirectURI }: {
state: string;
codeVerifier: string;
scopes?: string[];
redirectURI: string;
display?: string;
loginHint?: string;
}): Promise<URL>;
validateAuthorizationCode: ({ code, redirectURI }: {
code: string;
redirectURI: string;
codeVerifier?: string;
deviceId?: string;
}) => Promise<{
accessToken: string;
refreshToken: string | undefined;
accessTokenExpiresAt: Date | undefined;
idToken: string | undefined;
}>;
refreshAccessToken: ((refreshToken: string) => Promise<OAuth2Tokens>) | ((refreshToken: string) => Promise<{
accessToken: any;
refreshToken: any;
accessTokenExpiresAt: Date | undefined;
}>);
verifyIdToken(token: string, nonce: string | undefined): Promise<boolean>;
getUserInfo(token: OAuth2Tokens & {
user?: {
name?: {
firstName?: string;
lastName?: string;
};
email?: string;
};
}): Promise<{
user: {
id: string;
name?: string;
email?: string | null;
image?: string;
emailVerified: boolean;
[key: string]: any;
};
data: any;
} | {
user: {
id: string;
name: string;
email: string;
image: string | undefined;
emailVerified: boolean;
} | {
id: string;
name: string;
email: string | null;
image: string;
emailVerified: boolean;
} | {
id: string;
name: string;
email: string | null;
image: string;
emailVerified: boolean;
};
data: PayPalProfile;
} | null>;
options: PayPalOptions;
};
interface LineIdTokenPayload {
iss: string;
sub: string;
aud: string;
exp: number;
iat: number;
name?: string;
picture?: string;
email?: string;
amr?: string[];
nonce?: string;
}
interface LineUserInfo {
sub: string;
name?: string;
picture?: string;
email?: string;
}
interface LineOptions extends ProviderOptions<LineUserInfo | LineIdTokenPayload> {
}
/**
* LINE Login v2.1
* - Authorization endpoint: https://access.line.me/oauth2/v2.1/authorize
* - Token endpoint: https://api.line.me/oauth2/v2.1/token
* - UserInfo endpoint: https://api.line.me/oauth2/v2.1/userinfo
* - Verify ID token: https://api.line.me/oauth2/v2.1/verify
*
* Docs: https://developers.line.biz/en/reference/line-login/#issue-access-token
*/
declare const line: (options: LineOptions) => {
id: "line";
name: string;
createAuthorizationURL({ state, scopes, codeVerifier, redirectURI, loginHint, }: {
state: string;
codeVerifier: string;
scopes?: string[];
redirectURI: string;
display?: string;
loginHint?: string;
}): Promise<URL>;
validateAuthorizationCode: ({ code, codeVerifier, redirectURI }: {
code: string;
redirectURI: string;
codeVerifier?: string;
deviceId?: string;
}) => Promise<OAuth2Tokens>;
refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
verifyIdToken(token: string, nonce: string | undefined): Promise<boolean>;
getUserInfo(token: OAuth2Tokens & {
user?: {
name?: {
firstName?: string;
lastName?: string;
};
email?: string;
};
}): Promise<{
user: {
id: string;
name?: string;
email?: string | null;
image?: string;
emailVerified: boolean;
[key: string]: any;
};
data: any;
} | {
user: {
id: any;
name: any;
email: any;
image: any;
emailVerified: false;
} | {
id: any;
name: any;
email: any;
image: any;
emailVerified: boolean;
} | {
id: any;
name: any;
email: any;
image: any;
emailVerified: boolean;
};
data: any;
} | null>;
options: LineOptions;
};
interface NaverProfile {
/** API response result code */
resultcode: string;
/** API response message */
message: string;
response: {
/** Unique Naver user identifier */
id: string;
/** User nickname */
nickname: string;
/** User real name */
name: string;
/** User email address */
email: string;
/** Gender (F: female, M: male, U: unknown) */
gender: string;
/** Age range */
age: string;
/** Birthday (MM-DD format) */
birthday: string;
/** Birth year */
birthyear: string;
/** Profile image URL */
profile_image: string;
/** Mobile phone number */
mobile: string;
};
}
interface NaverOptions extends ProviderOptions<NaverProfile> {
}
declare const naver: (options: NaverOptions) => {
id: "naver";
name: string;
createAuthorizationURL({ state, scopes, redirectURI }: {
state: string;
codeVerifier: string;
scopes?: string[];
redirectURI: string;
display?: string;
loginHint?: string;
}): Promise<URL>;
validateAuthorizationCode: ({ code, redirectURI }: {
code: string;
redirectURI: string;
codeVerifier?: string;
deviceId?: string;
}) => Promise<OAuth2Tokens>;
refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
getUserInfo(token: OAuth2Tokens & {
user?: {
name?: {
firstName?: string;
lastName?: string;
};
email?: string;
};
}): Promise<{
user: {
id: string;
name?: string;
email?: string | null;
image?: string;
emailVerified: boolean;
[key: string]: any;
};
data: any;
} | {
user: {
id: string;
name: string;
email: string;
image: string;
emailVerified: boolean;
} | {
id: string;
name: string;
email: string | null;
image: string;
emailVerified: boolean;
} | {
id: string;
name: string;
email: string | null;
image: string;
emailVerified: boolean;
};
data: NaverProfile;
} | null>;
options: NaverOptions;
};
interface Partner {
/** Partner-specific ID (consent required: kakaotalk_message) */
uuid?: string;
}
interface Profile {
/** Nickname (consent required: profile/nickname) */
nickname?: string;
/** Thumbnail image URL (consent required: profile/profile image) */
thumbnail_image_url?: string;
/** Profile image URL (consent required: profile/profile image) */
profile_image_url?: string;
/** Whether the profile image is the default */
is_default_image?: boolean;
/** Whether the nickname is the default */
is_default_nickname?: boolean;
}
interface KakaoAccount {
/** Consent required: profile info (nickname/profile image) */
profile_needs_agreement?: boolean;
/** Consent required: nickname */
profile_nickname_needs_agreement?: boolean;
/** Consent required: profile image */
profile_image_needs_agreement?: boolean;
/** Profile info */
profile?: Profile;
/** Consent required: name */
name_needs_agreement?: boolean;
/** Name */
name?: string;
/** Consent required: email */
email_needs_agreement?: boolean;
/** Email valid */
is_email_valid?: boolean;
/** Email verified */
is_email_verified?: boolean;
/** Email */
email?: string;
/** Consent required: age range */
age_range_needs_agreement?: boolean;
/** Age range */
age_range?: string;
/** Consent required: birth year */
birthyear_needs_agreement?: boolean;
/** Birth year (YYYY) */
birthyear?: string;
/** Consent required: birthday */
birthday_needs_agreement?: boolean;
/** Birthday (MMDD) */
birthday?: string;
/** Birthday type (SOLAR/LUNAR) */
birthday_type?: string;
/** Whether birthday is in a leap month */
is_leap_month?: boolean;
/** Consent required: gender */
gender_needs_agreement?: boolean;
/** Gender (male/female) */
gender?: string;
/** Consent required: phone number */
phone_number_needs_agreement?: boolean;
/** Phone number */
phone_number?: string;
/** Consent required: CI */
ci_needs_agreement?: boolean;
/** CI (unique identifier) */
ci?: string;
/** CI authentication time (UTC) */
ci_authenticated_at?: string;
}
interface KakaoProfile {
/** Kakao user ID */
id: number;
/**
* Whether the user has signed up (only present if auto-connection is disabled)
* false: preregistered, true: registered
*/
has_signed_up?: boolean;
/** UTC datetime when the user connected the service */
connected_at?: string;
/** UTC datetime when the user signed up via Kakao Sync */
synched_at?: string;
/** Custom user properties */
properties?: Record<string, any>;
/** Kakao account info */
kakao_account: KakaoAccount;
/** Partner info */
for_partner?: Partner;
}
interface KakaoOptions extends ProviderOptions<KakaoProfile> {
}
declare const kakao: (options: KakaoOptions) => {
id: "kakao";
name: string;
createAuthorizationURL({ state, scopes, redirectURI }: {
state: string;
codeVerifier: string;
scopes?: string[];
redirectURI: string;
display?: string;
loginHint?: string;
}): Promise<URL>;
validateAuthorizationCode: ({ code, redirectURI }: {
code: string;
redirectURI: string;
codeVerifier?: string;
deviceId?: string;
}) => Promise<OAuth2Tokens>;
refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
getUserInfo(token: OAuth2Tokens & {
user?: {
name?: {
firstName?: string;
lastName?: string;
};
email? /** Name */: string;
};
}): Promise<{
user: {
id: string;
name?: string;
email?: string | null;
image?: string;
emailVerified: boolean;
[key: string]: any;
};
data: any;
} | {
user: {
id: string;
name: string | undefined;
email: string | undefined;
image: string | undefined;
emailVerified: boolean;
} | {
id: string;
name: string;
email: string | null;
image: string;
emailVerified: boolean;
} | {
id: string;
name: string;
email: string | null;
image: string;
emailVerified: boolean;
};
data: KakaoProfile;
} | null>;
options: KakaoOptions;
};
interface NotionProfile {
object: "user";
id: string;
type: "person" | "bot";
name?: string;
avatar_url?: string;
person?: {
email?: string;
};
}
interface NotionOptions extends ProviderOptions<NotionProfile> {
}
declare const notion: (options: NotionOptions) => {
id: "notion";
name: string;
createAuthorizationURL({ state, scopes, loginHint, redirectURI }: {
state: string;
codeVerifier: string;
scopes?: string[];
redirectURI: string;
display?: string;
loginHint?: string;
}): Promise<URL>;
validateAuthorizationCode: ({ code, redirectURI }: {
code: string;
redirectURI: string;
codeVerifier?: string;
deviceId?: string;
}) => Promise<OAuth2Tokens>;
refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
getUserInfo(token: OAuth2Tokens & {
user?: {
name?: {
firstName?: string;
lastName?: string;
};
email?: string;
};
}): Promise<{
user: {
id: string;
name?: string;
email?: string | null;
image?: string;
emailVerified: boolean;
[key: string]: any;
};
data: any;
} | null>;
options: NotionOptions;
};
type LoginType = 0 /** Facebook OAuth */ | 1 /** Google OAuth */ | 24 /** Apple OAuth */ | 27 /** Microsoft OAuth */ | 97 /** Mobile device */ | 98 /** RingCentral OAuth */ | 99 /** API user */ | 100 /** Zoom Work email */ | 101; /** Single Sign-On (SSO) */
type AccountStatus = "pending" | "active" | "inactive";
type PronounOption = 1 /** Ask the user every time */ | 2 /** Always display */ | 3; /** Do not display */
interface PhoneNumber {
/** The country code of the phone number (Example: "+1") */
code: string;
/** The country of the phone number (Example: "US") */
country: string;
/** The label for the phone number (Example: "Mobile") */
label: string;
/** The phone number itself (Example: "800000000") */
number: string;
/** Whether the phone number has been verified (Example: true) */
verified: boolean;
}
/**
* See the full documentation below:
* https://developers.zoom.us/docs/api/users/#tag/users/GET/users/{userId}
*/
interface ZoomProfile extends Record<string, any> {
/** The user's account ID (Example: "q6gBJVO5TzexKYTb_I2rpg") */
account_id: string;
/** The user's account number (Example: 10009239) */
account_number: number;
/** The user's cluster (Example: "us04") */
cluster: string;
/** The user's CMS ID. Only enabled for Kaltura integration (Example: "KDcuGIm1QgePTO8WbOqwIQ") */
cms_user_id: string;
/** The user's cost center (Example: "cost center") */
cost_center: string;
/** User create time (Example: "2018-10-31T04:32:37Z") */
created_at: string;
/** Department (Example: "Developers") */
dept: string;
/** User's display name (Example: "Jill Chill") */
display_name: string;
/** User's email address (Example: "jchill@example.com") */
email: string;
/** User's first name (Example: "Jill") */
first_name: string;
/** IDs of the web groups that the user belongs to (Example: ["RSMaSp8sTEGK0_oamiA2_w"]) */
group_ids: string[];
/** User ID (Example: "zJKyaiAyTNC-MWjiWC18KQ") */
id: string;
/** IM IDs of the groups that the user belongs to (Example: ["t-_-d56CSWG-7BF15LLrOw"]) */
im_group_ids: string[];
/** The user's JID (Example: "jchill@example.com") */
jid: string;
/** The user's job title (Example: "API Developer") */
job_title: string;
/** Default language for the Zoom Web Portal (Example: "en-US") */
language: string;
/** User last login client version (Example: "5.9.6.4993(mac)") */
last_client_version: string;
/** User last login time (Example: "2021-05-05T20:40:30Z") */
last_login_time: string;
/** User's last name (Example: "Chill") */
last_name: string;
/** The time zone of the user (Example: "Asia/Shanghai") */
timezone: string;
/** User's location (Example: "Paris") */
location: string;
/** The user's login method (Example: 101) */
login_types: LoginType[];
/** User's personal meeting URL (Example: "example.com") */
personal_meeting_url: string;
/** This field has been deprecated and will not be supported in the future.
* Use the phone_numbers field instead of this field.
* The user's phone number (Example: "+1 800000000") */
phone_number?: string;
/** The URL for user's profile picture (Example: "example.com") */
pic_url: string;
/** Personal Meeting ID (PMI) (Example: 3542471135) */
pmi: number;
/** Unique identifier of the user's assigned role (Example: "0") */
role_id: string;
/** User's role name (Example: "Admin") */
role_name: string;
/** Status of user's account (Example: "pending") */
status: AccountStatus;
/** Use the personal meeting ID (PMI) for instant meetings (Example: false) */
use_pmi: boolean;
/** The time and date when the user was created (Example: "2018-10-31T04:32:37Z") */
user_created_at: string;
/** Displays whether user is verified or not (Example: 1) */
verified: number;
/** The user's Zoom Workplace plan option (Example: 64) */
zoom_one_type: number;
/** The user's company (Example: "Jill") */
company?: string;
/** Custom attributes that have been assigned to the user (Example: [{ "key": "cbf_cywdkexrtqc73f97gd4w6g", "name": "A1", "value": "1" }]) */
custom_attributes?: {
key: string;
name: string;
value: string;
}[];
/** The employee's unique ID. This field only returns when SAML single sign-on (SSO) is enabled.
* The `login_type` value is `101` (SSO) (Example: "HqDyI037Qjili1kNsSIrIg") */
employee_unique_id?: string;
/** The manager for the user (Example: "thill@example.com") */
manager?: string;
/** The user's country for the company phone number (Example: "US")
* @deprecated true */
phone_country?: string;
/** The phone number's ISO country code (Example: "+1") */
phone_numbers?: PhoneNumber[];
/** The user's plan type (Example: "1") */
plan_united_type?: string;
/** The user's pronouns (Example: "3123") */
pronouns?: string;
/** The user's display pronouns setting (Example: 1) */
pronouns_option?: PronounOption;
/** Personal meeting room URL, if the user has one (Example: "example.com") */
vanity_url?: string;
}
interface ZoomOptions extends ProviderOptions<ZoomProfile> {
pkce?: boolean;
}
declare const zoom: (userOptions: ZoomOptions) => {
id: "zoom";
name: string;
createAuthorizationURL: ({ state, redirectURI, codeVerifier }: {
state: string;
codeVerifier: string;
scopes?: string[];
redirectURI: string;
display?: string;
loginHint?: string;
}) => Promise<URL>;
validateAuthorizationCode: ({ code, redirectURI, codeVerifier }: {
code: string;
redirectURI: string;
codeVerifier?: string;
deviceId?: string;
}) => Promise<OAuth2Tokens>;
getUserInfo(token: OAuth2Tokens & {
user?: {
name?: {
firstName?: string;
lastName?: string;
};
email?: string;
};
}): Promise<{
user: {
id: string;
name?: string;
email?: string | null;
image?: string;
emailVerified: boolean;
[key: string]: any;
};
data: any;
} | null>;
};
interface VkProfile {
user: {
user_id: string;
first_name: string;
last_name: string;
email?: string;
phone?: number;
avatar?: string;
sex?: number;
verified?: boolean;
birthday: string;
};
}
interface VkOption extends ProviderOptions {
scheme?: "light" | "dark";
}
declare const vk: (options: VkOption) => {
id: "vk";
name: string;
createAuthorizationURL({ state, scopes, codeVerifier, redirectURI }: {
state: string;
codeVerifier: string;
scopes?: string[];
redirectURI: string;
display?: string;
loginHint?: string;
}): Promise<URL>;
validateAuthorizationCode: ({ code, codeVerifier, redirectURI, deviceId, }: {
code: string;
redirectURI: string;
codeVerifier?: string;
deviceId?: string;
}) => Promise<OAuth2Tokens>;
refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
getUserInfo(data: OAuth2Tokens & {
user?: {
name?: {
firstName?: string;
lastName?: string;
};
email?: string;
};
}): Promise<{
user: {
id: string;
name?: string;
email?: string | null;
image?: string;
emailVerified: boolean;
[key: string]: any;
};
data: any;
} | null>;
options: VkOption;
};
interface SalesforceProfile {
sub: string;
user_id: string;
organization_id: string;
preferred_username?: string;
email: string;
email_verified?: boolean;
name: string;
given_name?: string;
family_name?: string;
zoneinfo?: string;
photos?: {
picture?: string;
thumbnail?: string;
};
}
interface SalesforceOptions extends ProviderOptions<SalesforceProfile> {
environment?: "sandbox" | "production";
loginUrl?: string;
/**
* Override the redirect URI if auto-detection fails.
* Should match the Callback URL configured in your Salesforce Connected App.
* @example "http://localhost:3000/api/auth/callback/salesforce"
*/
redirectURI?: string;
}
declare const salesforce: (options: SalesforceOptions) => {
id: "salesforce";
name: string;
createAuthorizationURL({ state, scopes, codeVerifier, redirectURI }: {
state: string;
codeVerifier: string;
scopes?: string[];
redirectURI: string;
display?: string;
loginHint?: string;
}): Promise<URL>;
validateAuthorizationCode: ({ code, codeVerifier, redirectURI }: {
code: string;
redirectURI: string;
codeVerifier?: string;
deviceId?: string;
}) => Promise<OAuth2Tokens>;
refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
getUserInfo(token: OAuth2Tokens & {
user?: {
name?: {
firstName?: string;
lastName?: string;
};
email?: string;
};
}): Promise<{
user: {
id: string;
name?: string;
email?: string | null;
image?: string;
emailVerified: boolean;
[key: string]: any;
};
data: any;
} | null>;
options: SalesforceOptions;
};
interface RobloxProfile extends Record<string, any> {
/** the user's id */
sub: string;
/** the user's username */
preferred_username: string;
/** the user's display name, will return the same value as the preferred_username if not set */
nickname: string;
/** the user's display name, again, will return the same value as the preferred_username if not set */
name: string;
/** the account creation date as a unix timestamp in seconds */
created_at: number;
/** the user's profile URL */
profile: string;
/** the user's avatar URL */
picture: string;
}
interface RobloxOptions extends ProviderOptions<RobloxProfile> {
prompt?: "none" | "consent" | "login" | "select_account" | "select_account consent";
}
declare const roblox: (options: RobloxOptions) => {
id: "roblox";
name: string;
createAuthorizationURL({ state, scopes, redirectURI }: {
state: string;
codeVerifier: string;
scopes?: string[];
redirectURI: string;
display?: string;
loginHint?: string;
}): URL;
validateAuthorizationCode: ({ code, redirectURI }: {
code: string;
redirectURI: string;
codeVerifier?: string;
deviceId?: string;
}) => Promise<OAuth2Tokens>;
refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
getUserInfo(token: OAuth2Tokens & {
user?: {
name?: {
firstName?: string;
lastName?: string;
};
email?: string;
};
}): Promise<{
user: {
id: string;
name?: string;
email?: string | null;
image?: string;
emailVerified: boolean;
[key: string]: any;
};
data: any;
} | null>;
options: RobloxOptions;
};
interface RedditProfile {
id: string;
name: string;
icon_img: string | null;
has_verified_email: boolean;
oauth_client_id: string;
verified: boolean;
}
interface RedditOptions extends ProviderOptions<RedditProfile> {
duration?: string;
}
declare const reddit: (options: RedditOptions) => {
id: "reddit";
name: string;
createAuthorizationURL({ state, scopes, redirectURI }: {
state: string;
codeVerifier: string;
scopes?: string[];
redirectURI: string;
display?: string;
loginHint?: string;
}): Promise<URL>;
validateAuthorizationCode: ({ code, redirectURI }: {
code: string;
redirectURI: string;
codeVerifier?: string;
deviceId?: string;
}) => Promise<OAuth2Tokens>;
refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
getUserInfo(token: OAuth2Tokens & {
user?: {
name?: {
firstName?: string;
lastName?: string;
};
email?: string;
};
}): Promise<{
user: {
id: string;
name?: string;
email?: string | null;
image?: string;
emailVerified: boolean;
[key: string]: any;
};
data: any;
} | null>;
options: RedditOptions;
};
/**
* [More info](https://developers.tiktok.com/doc/tiktok-api-v2-get-user-info/)
*/
interface TiktokProfile extends Record<string, any> {
data: {
user: {
/**
* The unique identification of the user in the current application.Open id
* for the client.
*
* To return this field, add `fields=open_id` in the user profile request's query parameter.
*/
open_id: string;
/**
* The unique identification of the user across different apps for the same developer.
* For example, if a partner has X number of clients,
* it will get X number of open_id for the same TikTok user,
* but one persistent union_id for the particular user.
*
* To return this field, add `fields=union_id` in the user profile request's query parameter.
*/
union_id?: string;
/**
* User's profile image.
*
* To return this field, add `fields=avatar_url` in the user profile request's query parameter.
*/
avatar_url?: string;
/**
* User`s profile image in 100x100 size.
*
* To return this field, add `fields=avatar_url_100` in the user profile request's query parameter.
*/
avatar_url_100?: string;
/**
* User's profile image with higher resolution
*
* To return this field, add `fields=avatar_url_100` in the user profile request's query parameter.
*/
avatar_large_url: string;
/**
* User's profile name
*
* To return this field, add `fields=display_name` in the user profile request's query parameter.
*/
display_name: string;
/**
* User's username.
*
* To return this field, add `fields=username` in the user profile request's query parameter.
*/
username: string;
/** @note Email is currently unsupported by TikTok */
email?: string;
/**
* User's bio description if there is a valid one.
*
* To return this field, add `fields=bio_description` in the user profile request's query parameter.
*/
bio_description?: string;
/**
* The link to user's TikTok profile page.
*
* To return this field, add `fields=profile_deep_link` in the user profile request's query parameter.
*/
profile_deep_link?: string;
/**
* Whether TikTok has provided a verified badge to the account after confirming
* that it belongs to the user it represents.
*
* To return this field, add `fields=is_verified` in the user profile request's query parameter.
*/
is_verified?: boolean;
/**
* User's followers count.
*
* To return this field, add `fields=follower_count` in the user profile request's query parameter.
*/
follower_count?: number;
/**
* The number of accounts that the user is following.
*
* To return this field, add `fields=following_count` in the user profile request's query parameter.
*/
following_count?: number;
/**
* The total number of likes received by the user across all of their videos.
*
* To return this field, add `fields=likes_count` in the user profile request's query parameter.
*/
likes_count?: number;
/**
* The total number of publicly posted videos by the user.
*
* To return this field, add `fields=video_count` in the user profile request's query parameter.
*/
video_count?: number;
};
};
error?: {
/**
* The error category in string.
*/
code?: string;
/**
* The error message in string.
*/
message?: string;
/**
* The error message in string.
*/
log_id?: string;
};
}
interface TiktokOptions extends Omit<ProviderOptions, "clientId" | "clientSecret" | "clientKey"> {
clientId?: never;
clientSecret: string;
clientKey: string;
}
declare const tiktok: (options: TiktokOptions) => {
id: "tiktok";
name: string;
createAuthorizationURL({ state, scopes, redirectURI }: {
state: string;
codeVerifier: string;
scopes?: string[];
redirectURI: string;
display?: string;
loginHint?: string;
}): URL;
validateAuthorizationCode: ({ code, redirectURI }: {
code: string;
redirectURI: string;
codeVerifier?: string;
deviceId?: string;
}) => Promise<OAuth2Tokens>;
refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
getUserInfo(token: OAuth2Tokens & {
user?: {
name?: {
firstName?: string;
lastName?: string;
};
email?: string;
};
}): Promise<{
user: {
id: string;
name?: string;
email?: string | null;
image?: string;
emailVerified: boolean;
[key: string]: any;
};
data: any;
} | null>;
options: TiktokOptions;
};
interface GitlabProfile extends Record<string, any> {
id: number;
username: string;
email: string;
name: string;
state: string;
avatar_url: string;
web_url: string;
created_at: string;
bio: string;
location?: string;
public_email: string;
skype: string;
linkedin: string;
twitter: string;
website_url: string;
organization: string;
job_title: string;
pronouns: string;
bot: boolean;
work_information?: string;
followers: number;
following: number;
local_time: string;
last_sign_in_at: string;
confirmed_at: string;
theme_id: number;
last_activity_on: string;
color_scheme_id: number;
projects_limit: number;
current_sign_in_at: string;
identities: Array<{
provider: string;
extern_uid: string;
}>;
can_create_group: boolean;
can_create_project: boolean;
two_factor_enabled: boolean;
external: boolean;
private_profile: boolean;
commit_email: string;
shared_runners_minutes_limit: number;
extra_shared_runners_minutes_limit: number;
}
interface GitlabOptions extends ProviderOptions<GitlabProfile> {
issuer?: string;
}
declare const gitlab: (options: GitlabOptions) => {
id: "gitlab";
name: string;
createAuthorizationURL: ({ state, scopes, codeVerifier, loginHint, redirectURI, }: {
state: string;
codeVerifier: string;
scopes?: string[];
redirectURI: string;
display?: string;
loginHint?: string;
}) => Promise<URL>;
validateAuthorizationCode: ({ code, redirectURI, codeVerifier }: {
code: string;
redirectURI: string;
codeVerifier?: string;
deviceId?: string;
}) => Promise<OAuth2Tokens>;
refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
getUserInfo(token: OAuth2Tokens & {
user?: {
name?: {
firstName?: string;
lastName?: string;
};
email?: string;
};
}): Promise<{
user: {
id: string;
name?: string;
email?: string | null;
image?: string;
emailVerified: boolean;
[key: string]: any;
};
data: any;
} | {
user: {
id: number;
name: string;
email: string;
image: string;
emailVerified: true;
} | {
id: string | number;
name: string;
email: string | null;
image: string;
emailVerified: boolean;
} | {
id: string | number;
name: string;
email: string | null;
image: string;
emailVerified: boolean;
};
data: GitlabProfile;
} | null>;
options: GitlabOptions;
};
interface LinkedInProfile {
sub: string;
name: string;
given_name: string;
family_name: string;
picture: string;
locale: {
country: string;
language: string;
};
email: string;
email_verified: boolean;
}
interface LinkedInOptions extends ProviderOptions<LinkedInProfile> {
}
declare const linkedin: (options: LinkedInOptions) => {
id: "linkedin";
name: string;
createAuthorizationURL: ({ state, scopes, redirectURI, loginHint, }: {
state: string;
codeVerifier: string;
scopes?: string[];
redirectURI: string;
display?: string;
loginHint?: string;
}) => Promise<URL>;
validateAuthorizationCode: ({ code, redirectURI }: {
code: string;
redirectURI: string;
codeVerifier?: string;
deviceId?: string;
}) => Promise<OAuth2Tokens>;
refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
getUserInfo(token: OAuth2Tokens & {
user?: {
name?: {
firstName?: string;
lastName?: string;
};
email?: string;
};
}): Promise<{
user: {
id: string;
name?: string;
email?: string | null;
image?: string;
emailVerified: boolean;
[key: string]: any;
};
data: any;
} | null>;
options: LinkedInOptions;
};
interface LinearUser {
id: string;
name: string;
email: string;
avatarUrl?: string;
active: boolean;
createdAt: string;
updatedAt: string;
}
interface LinearProfile {
data: {
viewer: LinearUser;
};
}
interface LinearOptions extends ProviderOptions<LinearUser> {
}
declare const linear: (options: LinearOptions) => {
id: "linear";
name: string;
createAuthorizationURL({ state, scopes, loginHint, redirectURI }: {
state: string;
codeVerifier: string;
scopes?: string[];
redirectURI: string;
display?: string;
loginHint?: string;
}): Promise<URL>;
validateAuthorizationCode: ({ code, redirectURI }: {
code: string;
redirectURI: string;
codeVerifier?: string;
deviceId?: string;
}) => Promise<OAuth2Tokens>;
refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
getUserInfo(token: OAuth2Tokens & {
user?: {
name?: {
firstName?: string;
lastName?: string;
};
email?: string;
};
}): Promise<{
user: {
id: string;
name?: string;
email?: string | null;
image?: string;
emailVerified: boolean;
[key: string]: any;
};
data: any;
} | null>;
options: LinearOptions;
};
interface KickProfile {
/**
* The user id of the user
*/
user_id: string;
/**
* The name of the user
*/
name: string;
/**
* The email of the user
*/
email: string;
/**
* The picture of the user
*/
profile_picture: string;
}
interface KickOptions extends ProviderOptions<KickProfile> {
}
declare const kick: (options: KickOptions) => {
id: "kick";
name: string;
createAuthorizationURL({ state, scopes, redirectURI, codeVerifier }: {
state: string;
codeVerifier: string;
scopes?: string[];
redirectURI: string;
display?: string;
loginHint?: string;
}): Promise<URL>;
validateAuthorizationCode({ code, redirectURI, codeVerifier }: {
code: string;
redirectURI: string;
codeVerifier?: string;
deviceId?: string;
}): Promise<OAuth2Tokens>;
getUserInfo(token: OAuth2Tokens & {
user?: {
name?: {
firstName?: string;
lastName?: string;
};
email?: string;
};
}): Promise<{
user: {
id: string;
name?: string;
email?: string | null;
image?: string;
emailVerified: boolean;
[key: string]: any;
};
data: any;
} | null>;
options: KickOptions;
};
interface DropboxProfile {
account_id: string;
name: {
given_name: string;
surname: string;
familiar_name: string;
display_name: string;
abbreviated_name: string;
};
email: string;
email_verified: boolean;
profile_photo_url: string;
}
interface DropboxOptions extends ProviderOptions<DropboxProfile> {
accessType?: "offline" | "online" | "legacy";
}
declare const dropbox: (options: DropboxOptions) => {
id: "dropbox";
name: string;
createAuthorizationURL: ({ state, scopes, codeVerifier, redirectURI, }: {
state: string;
codeVerifier: string;
scopes?: string[];
redirectURI: string;
display?: string;
loginHint?: string;
}) => Promise<URL>;
validateAuthorizationCode: ({ code, codeVerifier, redirectURI }: {
code: string;
redirectURI: string;
codeVerifier?: string;
deviceId?: string;
}) => Promise<OAuth2Tokens>;
refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
getUserInfo(token: OAuth2Tokens & {
user?: {
name?: {
firstName?: string;
lastName?: string;
};
email?: string;
};
}): Promise<{
user: {
id: string;
name?: string;
email?: string | null;
image?: string;
emailVerified: boolean;
[key: string]: any;
};
data: any;
} | null>;
options: DropboxOptions;
};
interface TwitterProfile {
data: {
/**
* Unique identifier of this user. This is returned as a string in order to avoid complications with languages and tools
* that cannot handle large integers.
*/
id: string;
/** The friendly name of this user, as shown on their profile. */
name: string;
/** The email address of this user. */
email?: string;
/** The Twitter handle (screen name) of this user. */
username: string;
/**
* The location specified in the user's profile, if the user provided one.
* As this is a freeform value, it may not indicate a valid location, but it may be fuzzily evaluated when performing searches with location queries.
*
* To return this field, add `user.fields=location` in the authorization request's query parameter.
*/
location?: string;
/**
* This object and its children fields contain details about text that has a special meaning in the user's description.
*
*To return this field, add `user.fields=entities` in the authorization request's query parameter.
*/
entities?: {
/** Contains details about the user's profile website. */
url: {
/** Contains details about the user's profile website. */
urls: Array<{
/** The start position (zero-based) of the recognized user's profile website. All start indices are inclusive. */
start: number;
/** The end position (zero-based) of the recognized user's profile website. This end index is exclusive. */
end: number;
/** The URL in the format entered by the user. */
url: string;
/** The fully resolved URL. */
expanded_url: string;
/** The URL as displayed in the user's profile. */
display_url: string;
}>;
};
/** Contains details about URLs, Hashtags, Cashtags, or mentions located within a user's description. */
description: {
hashtags: Array<{
start: number;
end: number;
tag: string;
}>;
};
};
/**
* Indicate if this user is a verified Twitter user.
*
* To return this field, add `user.fields=verified` in the authorization request's query parameter.
*/
verified?: boolean;
/**
* The text of this user's profile description (also known as bio), if the user provided one.
*
* To return this field, add `user.fields=description` in the authorization request's query parameter.
*/
description?: string;
/**
* The URL specified in the user's profile, if present.
*
* To return this field, add `user.fields=url` in the authorization request's query parameter.
*/
url?: string;
/** The URL to the profile image for this user, as shown on the user's profile. */
profile_image_url?: string;
protected?: boolean;
/**
* Unique identifi