Getting Started
Ce contenu n'est pas encore disponible dans votre langue.
Install
Section titled “Install”bun add @capgo/capacitor-firebase-authenticationbunx cap syncImport
Section titled “Import”import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';API Overview
Section titled “API Overview”applyActionCode
Section titled “applyActionCode”Applies a verification code sent to the user by email.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.applyActionCode({} as ApplyActionCodeOptions);confirmPasswordReset
Section titled “confirmPasswordReset”Completes the password reset process.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.confirmPasswordReset({} as ConfirmPasswordResetOptions);confirmVerificationCode
Section titled “confirmVerificationCode”Finishes the phone number verification process.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.confirmVerificationCode({} as ConfirmVerificationCodeOptions);createUserWithEmailAndPassword
Section titled “createUserWithEmailAndPassword”Creates a new user account with email and password. If the new account was created, the user is signed in automatically.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.createUserWithEmailAndPassword({} as CreateUserWithEmailAndPasswordOptions);deleteUser
Section titled “deleteUser”Deletes and signs out the user.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.deleteUser();fetchSignInMethodsForEmail
Section titled “fetchSignInMethodsForEmail”Fetches the sign-in methods for an email address.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.fetchSignInMethodsForEmail({} as FetchSignInMethodsForEmailOptions);getCurrentUser
Section titled “getCurrentUser”Fetches the currently signed-in user.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.getCurrentUser();getPendingAuthResult
Section titled “getPendingAuthResult”Returns the SignInResult if your app launched a web sign-in flow and the OS cleans up the app while in the background.
Only available for Android.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.getPendingAuthResult();getIdToken
Section titled “getIdToken”Fetches the Firebase Auth ID Token for the currently signed-in user.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.getIdToken();getIdTokenResult
Section titled “getIdTokenResult”Returns a deserialized JSON Web Token (JWT) used to identify the user to a Firebase service.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.getIdTokenResult();getRedirectResult
Section titled “getRedirectResult”Returns the SignInResult from the redirect-based sign-in flow.
If sign-in was unsuccessful, fails with an error.
If no redirect operation was called, returns a SignInResult with a null user.
Only available for Web.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.getRedirectResult();getTenantId
Section titled “getTenantId”Get the tenant id.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.getTenantId();isSignInWithEmailLink
Section titled “isSignInWithEmailLink”Checks if an incoming link is a sign-in with email link suitable for signInWithEmailLink.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.isSignInWithEmailLink({} as IsSignInWithEmailLinkOptions);linkWithApple
Section titled “linkWithApple”Links the user account with Apple authentication provider.
The user must be logged in on the native layer.
The skipNativeAuth configuration option has no effect here.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithApple();linkWithEmailAndPassword
Section titled “linkWithEmailAndPassword”Links the user account with Email authentication provider.
The user must be logged in on the native layer.
The skipNativeAuth configuration option has no effect here.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithEmailAndPassword({} as LinkWithEmailAndPasswordOptions);linkWithEmailLink
Section titled “linkWithEmailLink”Links the user account with Email authentication provider.
The user must be logged in on the native layer.
The skipNativeAuth configuration option has no effect here.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithEmailLink({} as LinkWithEmailLinkOptions);linkWithFacebook
Section titled “linkWithFacebook”Links the user account with Facebook authentication provider.
The user must be logged in on the native layer.
The skipNativeAuth configuration option has no effect here.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithFacebook();linkWithGameCenter
Section titled “linkWithGameCenter”Links the user account with Game Center authentication provider.
The user must be logged in on the native layer.
The skipNativeAuth configuration option has no effect here.
Only available for iOS.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithGameCenter();linkWithGithub
Section titled “linkWithGithub”Links the user account with GitHub authentication provider.
The user must be logged in on the native layer.
The skipNativeAuth configuration option has no effect here.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithGithub();linkWithGoogle
Section titled “linkWithGoogle”Links the user account with Google authentication provider.
The user must be logged in on the native layer.
The skipNativeAuth configuration option has no effect here.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithGoogle();linkWithMicrosoft
Section titled “linkWithMicrosoft”Links the user account with Microsoft authentication provider.
The user must be logged in on the native layer.
The skipNativeAuth configuration option has no effect here.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithMicrosoft();linkWithOpenIdConnect
Section titled “linkWithOpenIdConnect”Links the user account with an OpenID Connect provider.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithOpenIdConnect({} as LinkWithOpenIdConnectOptions);linkWithPhoneNumber
Section titled “linkWithPhoneNumber”Links the user account with Phone Number authentication provider.
The user must be logged in on the native layer.
The skipNativeAuth configuration option has no effect here.
Use the phoneVerificationCompleted listener to be notified when the verification is completed.
Use the phoneVerificationFailed listener to be notified when the verification is failed.
Use the phoneCodeSent listener to get the verification id.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithPhoneNumber({} as LinkWithPhoneNumberOptions);linkWithPlayGames
Section titled “linkWithPlayGames”Links the user account with Play Games authentication provider.
The user must be logged in on the native layer.
The skipNativeAuth configuration option has no effect here.
Only available for Android.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithPlayGames();linkWithTwitter
Section titled “linkWithTwitter”Links the user account with Twitter authentication provider.
The user must be logged in on the native layer.
The skipNativeAuth configuration option has no effect here.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithTwitter();linkWithYahoo
Section titled “linkWithYahoo”Links the user account with Yahoo authentication provider.
The user must be logged in on the native layer.
The skipNativeAuth configuration option has no effect here.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithYahoo();reload
Section titled “reload”Reloads user account data, if signed in.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.reload();revokeAccessToken
Section titled “revokeAccessToken”Revokes the given access token. Currently only supports Apple OAuth access tokens.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.revokeAccessToken({} as RevokeAccessTokenOptions);sendEmailVerification
Section titled “sendEmailVerification”Sends a verification email to the currently signed in user.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.sendEmailVerification();sendPasswordResetEmail
Section titled “sendPasswordResetEmail”Sends a password reset email.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.sendPasswordResetEmail({} as SendPasswordResetEmailOptions);sendSignInLinkToEmail
Section titled “sendSignInLinkToEmail”Sends a sign-in email link to the user with the specified email.
To complete sign in with the email link, call signInWithEmailLink with the email address and the email link supplied in the email sent to the user.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.sendSignInLinkToEmail({} as SendSignInLinkToEmailOptions);setLanguageCode
Section titled “setLanguageCode”Sets the user-facing language code for auth operations.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.setLanguageCode({} as SetLanguageCodeOptions);setPersistence
Section titled “setPersistence”Sets the type of persistence for the currently saved auth session.
Only available for Web.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.setPersistence({} as SetPersistenceOptions);setTenantId
Section titled “setTenantId”Sets the tenant id.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.setTenantId({} as SetTenantIdOptions);signInAnonymously
Section titled “signInAnonymously”Signs in as an anonymous user.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInAnonymously();signInWithApple
Section titled “signInWithApple”Starts the Apple sign-in flow.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithApple();signInWithCustomToken
Section titled “signInWithCustomToken”Starts the Custom Token sign-in flow.
This method cannot be used in combination with skipNativeAuth on Android and iOS.
In this case you have to use the signInWithCustomToken interface of the Firebase JS SDK directly.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithCustomToken({} as SignInWithCustomTokenOptions);signInWithEmailAndPassword
Section titled “signInWithEmailAndPassword”Starts the sign-in flow using an email and password.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithEmailAndPassword({} as SignInWithEmailAndPasswordOptions);signInWithEmailLink
Section titled “signInWithEmailLink”Signs in using an email and sign-in email link.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithEmailLink({} as SignInWithEmailLinkOptions);signInWithFacebook
Section titled “signInWithFacebook”Starts the Facebook sign-in flow.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithFacebook();signInWithGameCenter
Section titled “signInWithGameCenter”Starts the Game Center sign-in flow.
Only available for iOS.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithGameCenter();signInWithGithub
Section titled “signInWithGithub”Starts the GitHub sign-in flow.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithGithub();signInWithGoogle
Section titled “signInWithGoogle”Starts the Google sign-in flow.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithGoogle();signInWithMicrosoft
Section titled “signInWithMicrosoft”Starts the Microsoft sign-in flow.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithMicrosoft();signInWithOpenIdConnect
Section titled “signInWithOpenIdConnect”Starts the OpenID Connect sign-in flow.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithOpenIdConnect({} as SignInWithOpenIdConnectOptions);signInWithPhoneNumber
Section titled “signInWithPhoneNumber”Starts the sign-in flow using a phone number.
Use the phoneVerificationCompleted listener to be notified when the verification is completed.
Use the phoneVerificationFailed listener to be notified when the verification is failed.
Use the phoneCodeSent listener to get the verification id.
Only available for Android and iOS.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithPhoneNumber({} as SignInWithPhoneNumberOptions);signInWithPlayGames
Section titled “signInWithPlayGames”Starts the Play Games sign-in flow.
Only available for Android.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithPlayGames();signInWithTwitter
Section titled “signInWithTwitter”Starts the Twitter sign-in flow.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithTwitter();signInWithYahoo
Section titled “signInWithYahoo”Starts the Yahoo sign-in flow.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithYahoo();signOut
Section titled “signOut”Starts the sign-out flow.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signOut();unlink
Section titled “unlink”Unlinks a provider from a user account.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.unlink({} as UnlinkOptions);updateEmail
Section titled “updateEmail”Updates the email address of the currently signed in user.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.updateEmail({} as UpdateEmailOptions);updatePassword
Section titled “updatePassword”Updates the password of the currently signed in user.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.updatePassword({} as UpdatePasswordOptions);updateProfile
Section titled “updateProfile”Updates a user’s profile data.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.updateProfile({} as UpdateProfileOptions);useAppLanguage
Section titled “useAppLanguage”Sets the user-facing language code to be the default app language.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.useAppLanguage();useEmulator
Section titled “useEmulator”Instrument your app to talk to the Authentication emulator.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.useEmulator({} as UseEmulatorOptions);verifyBeforeUpdateEmail
Section titled “verifyBeforeUpdateEmail”Verifies the new email address before updating the email address of the currently signed in user.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.verifyBeforeUpdateEmail({} as VerifyBeforeUpdateEmailOptions);checkAppTrackingTransparencyPermission
Section titled “checkAppTrackingTransparencyPermission”Checks the current status of app tracking transparency.
Only available on iOS.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.checkAppTrackingTransparencyPermission();requestAppTrackingTransparencyPermission
Section titled “requestAppTrackingTransparencyPermission”Opens the system dialog to authorize app tracking transparency.
Attention: The user may have disabled the tracking request in the device settings, see Apple’s documentation.
Only available on iOS.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.requestAppTrackingTransparencyPermission();Type Reference
Section titled “Type Reference”ApplyActionCodeOptions
Section titled “ApplyActionCodeOptions”export interface ApplyActionCodeOptions { /** * A verification code sent to the user. * * @since 0.2.2 */ oobCode: string;}ConfirmPasswordResetOptions
Section titled “ConfirmPasswordResetOptions”export interface ConfirmPasswordResetOptions { /** * A verification code sent to the user. * * @since 0.2.2 */ oobCode: string; /** * The new password. * * @since 0.2.2 */ newPassword: string;}ConfirmVerificationCodeOptions
Section titled “ConfirmVerificationCodeOptions”export interface ConfirmVerificationCodeOptions { /** * The verification ID received from the `phoneCodeSent` listener. * * The `verificationCode` option must also be provided. * * @since 5.0.0 */ verificationId: string; /** * The verification code either received from the `phoneCodeSent` listener or entered by the user. * * The `verificationId` option must also be provided. * * @since 5.0.0 */ verificationCode: string;}SignInResult
Section titled “SignInResult”export interface SignInResult { /** * The currently signed-in user, or null if there isn't any. * * @since 0.1.0 */ user: User | null; /** * Credentials returned by an auth provider. * * @since 0.1.0 */ credential: AuthCredential | null; /** * Additional user information from a federated identity provider. * * @since 0.5.1 */ additionalUserInfo: AdditionalUserInfo | null;}CreateUserWithEmailAndPasswordOptions
Section titled “CreateUserWithEmailAndPasswordOptions”export interface CreateUserWithEmailAndPasswordOptions { /** * @since 0.2.2 */ email: string; /** * @since 0.2.2 */ password: string;}FetchSignInMethodsForEmailOptions
Section titled “FetchSignInMethodsForEmailOptions”export interface FetchSignInMethodsForEmailOptions { /** * The user's email address. * * @since 6.0.0 */ email: string;}FetchSignInMethodsForEmailResult
Section titled “FetchSignInMethodsForEmailResult”export interface FetchSignInMethodsForEmailResult { /** * The sign-in methods for the specified email address. * * This list is empty when [Email Enumeration Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) * is enabled, irrespective of the number of authentication methods available for the given email. * * @since 6.0.0 */ signInMethods: string[];}GetCurrentUserResult
Section titled “GetCurrentUserResult”export interface GetCurrentUserResult { /** * The currently signed-in user, or null if there isn't any. * * @since 0.1.0 */ user: User | null;}GetIdTokenOptions
Section titled “GetIdTokenOptions”export interface GetIdTokenOptions { /** * Force refresh regardless of token expiration. * * @since 0.1.0 */ forceRefresh: boolean;}GetIdTokenResult
Section titled “GetIdTokenResult”export interface GetIdTokenResult { /** * The Firebase Auth ID token JWT string. * * @since 0.1.0 */ token: string;}GetIdTokenResultOptions
Section titled “GetIdTokenResultOptions”export interface GetIdTokenResultOptions { /** * Force refresh regardless of token expiration. * * @since 7.4.0 */ forceRefresh: boolean;}GetIdTokenResultResult
Section titled “GetIdTokenResultResult”export interface GetIdTokenResultResult { /** * The authentication time in milliseconds since the epoch. * * This is the time the user authenticated (signed in) and not the time the token was refreshed. * * @since 7.4.0 */ authTime: number; /** * The ID token expiration time in milliseconds since the epoch. * * @since 7.4.0 */ expirationTime: number; /** * The ID token issuance time in milliseconds since the epoch. * * @since 7.4.0 */ issuedAtTime: number; /** * The sign-in provider through which the ID token was obtained. * * @since 7.4.0 */ signInProvider: string | null; /** * The type of second factor associated with this session, provided the user was multi-factor * authenticated (eg. phone, etc). * * @since 7.4.0 */ signInSecondFactor: string | null; /** * The entire payload claims of the ID token including the standard reserved claims as well as * the custom claims. * * @since 7.4.0 */ claims: Record<string, unknown>;}Source Of Truth
Section titled “Source Of Truth”This page is generated from the plugin’s src/definitions.ts. Re-run the sync when the public API changes upstream.