///
///
import { AuthOptions } from './authOptions';
import { AuthParameters } from './authParameters';
import { AuthResult } from './authResult';
import { CaptchaParams } from './captcha';
import { HttpClient } from './httpClient';
import { IdentityEventManager } from './identityEventManager';
import { ApiClientConfig } from './main';
import MfaClient from './mfaClient';
import { AuthenticationToken, PasswordlessResponse, PasswordStrength, Scope, SessionInfo, SignupProfile } from './models';
import { PkceParams, WithPkceParams } from './pkceService';
export type LoginWithCredentialsParams = {
mediation?: 'silent' | 'optional' | 'required';
auth?: AuthOptions;
};
export type LoginWithCustomTokenParams = {
token: string;
auth: AuthOptions;
};
type LoginWithPasswordOptions = {
password: string;
saveCredentials?: boolean;
auth?: WithPkceParams;
action?: string;
} & CaptchaParams;
type EmailLoginWithPasswordParams = LoginWithPasswordOptions & {
email: string;
};
type PhoneNumberLoginWithPasswordParams = LoginWithPasswordOptions & {
phoneNumber: string;
};
type CustomIdentifierLoginWithPasswordParams = LoginWithPasswordOptions & {
customIdentifier: string;
};
export type LoginWithPasswordParams = EmailLoginWithPasswordParams | PhoneNumberLoginWithPasswordParams | CustomIdentifierLoginWithPasswordParams;
export type LogoutParams = {
redirectTo?: string;
removeCredentials?: boolean;
};
export type RevocationParams = {
tokens: string[];
};
export type RefreshTokenParams = {
refreshToken: string;
scope?: Scope;
};
export type SingleFactorPasswordlessParams = ({
authType: 'magic_link';
email?: string;
} | {
authType: 'sms';
phoneNumber?: string;
}) & CaptchaParams;
export type StepUpPasswordlessParams = {
authType: 'email' | 'sms';
stepUp: string;
};
export type PasswordlessParams = SingleFactorPasswordlessParams | StepUpPasswordlessParams;
export type SignupParams = {
data: SignupProfile;
returnToAfterEmailConfirmation?: string;
saveCredentials?: boolean;
auth?: WithPkceParams;
redirectUrl?: string;
} & CaptchaParams;
export type TokenRequestParameters = {
code: string;
redirectUri: string;
persistent?: boolean;
returnProviderToken?: boolean;
};
export type VerifyPasswordlessParams = {
authType: 'magic_link';
email: string;
verificationCode: string;
} | {
authType: 'sms';
phoneNumber: string;
verificationCode: string;
};
/**
* Identity Rest API Client
*/
export default class OAuthClient {
private config;
private http;
private eventManager;
private mfaClient;
private authorizeUrl;
private customTokenUrl;
private logoutUrl;
private revokeUrl;
private passwordlessVerifyUrl;
private passwordStrengthUrl;
private popupRelayUrl;
private tokenUrl;
private passwordLoginUrl;
private passwordlessStartUrl;
private passwordlessVerifyAuthCodeUrl;
private sessionInfoUrl;
private signupUrl;
private signupTokenUrl;
constructor(props: {
config: ApiClientConfig;
http: HttpClient;
eventManager: IdentityEventManager;
});
setMfaClient(mfaClient: MfaClient): void;
checkSession(opts?: WithPkceParams): Promise;
exchangeAuthorizationCodeWithPkce(params: TokenRequestParameters): Promise;
getPasswordStrength(password: string): Promise;
getSessionInfo(): Promise;
loginFromSession(opts?: WithPkceParams): Promise;
isPasswordCredential(credentials: Awaited>): credentials is PasswordCredential;
loginWithCredentials(params: LoginWithCredentialsParams): Promise;
loginWithCustomToken(params: LoginWithCustomTokenParams): void;
loginWithPassword(params: LoginWithPasswordParams): Promise;
loginWithSocialProvider(provider: string, opts?: WithPkceParams): Promise;
private loginWithIdToken;
private googleOneTap;
instantiateOneTap(opts?: AuthOptions): void;
logout(opts?: LogoutParams, revocationParams?: RevocationParams): Promise;
private revokeToken;
refreshTokens(params: RefreshTokenParams): Promise;
signup(params: SignupParams): Promise;
startPasswordless(params: PasswordlessParams, auth?: Omit, 'useWebMessage'>): Promise;
verifyPasswordless(params: VerifyPasswordlessParams, auth?: AuthOptions): Promise;
private getAuthorizationUrl;
private getWebMessage;
private loginWithPopup;
private computeProviderPopupOptions;
private redirectThruAuthorization;
private loginWithVerificationCode;
private ropcPasswordLogin;
private loginWithCordovaInAppBrowser;
private openInCordovaSystemBrowser;
private getAvailableBrowserTabPlugin;
private storeCredentialsInBrowser;
private resolveSingleFactorPasswordlessParams;
private resolveSecondFactorPasswordlessParams;
private hasLoggedWithEmail;
private hasLoggedWithPhoneNumber;
private getAuthenticationId;
loginCallback(tkn: AuthenticationToken, auth?: WithPkceParams): Promise;
private orchestratedFlowParams;
authParams(opts: WithPkceParams, { acceptPopupMode }?: {
acceptPopupMode?: boolean | undefined;
}, allowConfidentialCodeWebMsgFlowOverride?: boolean): {
responseType: import("./authOptions").ResponseType;
responseMode?: "web_message" | undefined;
scope: string;
display?: ("page" | "popup" | "touch" | "wap") | undefined;
redirectUri?: string | undefined;
prompt?: import("./authOptions").Prompt | undefined;
origin?: string | undefined;
state?: string | undefined;
nonce?: string | undefined;
providerScope?: string | undefined;
idTokenHint?: string | undefined;
loginHint?: string | undefined;
accessToken?: string | undefined;
persistent?: boolean | undefined;
codeChallenge?: string | undefined;
codeChallengeMethod?: string | undefined;
clientId: string;
};
getPkceParams(authParams: WithPkceParams): Promise;
acquireAuthorizationLock(): void;
acquireSessionLock(): void;
releaseSessionLock(): void;
isSessionLocked(): boolean;
releaseAuthorizationLock(): void;
isAuthorizationLocked(): boolean;
}
export {};