UNPKG

@firebase/auth

Version:

The Firebase Authenticaton component of the Firebase JS SDK.

99 lines (98 loc) 3.24 kB
/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { ActionCodeSettings, Auth, User } from '../../model/public_types'; /** * Gets the list of possible sign in methods for the given email address. * * @remarks * This is useful to differentiate methods of sign-in for the same provider, eg. * {@link EmailAuthProvider} which has 2 methods of sign-in, * {@link SignInMethod}.EMAIL_PASSWORD and * {@link SignInMethod}.EMAIL_LINK. * * @param auth - The {@link Auth} instance. * @param email - The user's email address. * * @public */ export declare function fetchSignInMethodsForEmail(auth: Auth, email: string): Promise<string[]>; /** * Sends a verification email to a user. * * @remarks * The verification process is completed by calling {@link applyActionCode}. * * @example * ```javascript * const actionCodeSettings = { * url: 'https://www.example.com/?email=user@example.com', * iOS: { * bundleId: 'com.example.ios' * }, * android: { * packageName: 'com.example.android', * installApp: true, * minimumVersion: '12' * }, * handleCodeInApp: true * }; * await sendEmailVerification(user, actionCodeSettings); * // Obtain code from the user. * await applyActionCode(auth, code); * ``` * * @param user - The user. * @param actionCodeSettings - The {@link ActionCodeSettings}. * * @public */ export declare function sendEmailVerification(user: User, actionCodeSettings?: ActionCodeSettings | null): Promise<void>; /** * Sends a verification email to a new email address. * * @remarks * The user's email will be updated to the new one after being verified. * * If you have a custom email action handler, you can complete the verification process by calling * {@link applyActionCode}. * * @example * ```javascript * const actionCodeSettings = { * url: 'https://www.example.com/?email=user@example.com', * iOS: { * bundleId: 'com.example.ios' * }, * android: { * packageName: 'com.example.android', * installApp: true, * minimumVersion: '12' * }, * handleCodeInApp: true * }; * await verifyBeforeUpdateEmail(user, 'newemail@example.com', actionCodeSettings); * // Obtain code from the user. * await applyActionCode(auth, code); * ``` * * @param user - The user. * @param newEmail - The new email address to be verified before update. * @param actionCodeSettings - The {@link ActionCodeSettings}. * * @public */ export declare function verifyBeforeUpdateEmail(user: User, newEmail: string, actionCodeSettings?: ActionCodeSettings | null): Promise<void>;