Démarrage
Copiez un prompt de configuration avec les étapes d'installation et la guide markdown complète pour ce plugin.
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-firebase-authentication`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/firebase-authentication/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
Installer
Section intitulée « Installer »bun add @capgo/capacitor-firebase-authenticationbunx cap syncImporter
Section intitulée « Importer »import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';Vue d'ensemble de API
Section intitulée « Vue d'ensemble de API »applyActionCode
Section intitulée « appliquerCodeDeVerification »Applique un code de vérification code envoyé à l'utilisateur par email.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.applyActionCode({} as ApplyActionCodeOptions);confirmPasswordReset
Section intitulée « confirmerRéinitialisationMotDePasse »Termine le processus de réinitialisation du mot de passe.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.confirmPasswordReset({} as ConfirmPasswordResetOptions);confirmVerificationCode
Section intitulée “confirmVerificationCode”Termine le processus de vérification du numéro de téléphone.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.confirmVerificationCode({} as ConfirmVerificationCodeOptions);createUserWithEmailAndPassword
Section intitulée “createUserWithEmailAndPassword”Crée un nouveau compte utilisateur avec adresse e-mail et mot de passe. Si le nouveau compte a été créé, l'utilisateur est connecté automatiquement.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.createUserWithEmailAndPassword({} as CreateUserWithEmailAndPasswordOptions);deleteUser
Section intitulée “deleteUser”Supprime et déconnecte l'utilisateur.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.deleteUser();fetchSignInMethodsForEmail
Section intitulée “fetchSignInMethodsForEmail”Récupère les méthodes de connexion pour une adresse e-mail.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.fetchSignInMethodsForEmail({} as FetchSignInMethodsForEmailOptions);getCurrentUser
Section intitulée “getCurrentUser”Récupère l'utilisateur actuellement connecté.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.getCurrentUser();getPendingAuthResult
Section intitulée “getPendingAuthResult”Renvoie le SignInResult Si votre application a lancé une session de connexion web et que le système d'exploitation supprime l'application pendant la phase de fond.
Disponible uniquement pour Android.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.getPendingAuthResult();getIdToken
Section intitulée “getIdToken”Récupère le jeton d'authentification Firebase pour l'utilisateur actuellement connecté.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.getIdToken();getIdTokenResult
Section intitulée “getIdTokenResult”Renvoie un jeton Web JSON désérialisé (JWT) utilisé pour identifier l'utilisateur à un service Firebase.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.getIdTokenResult();getRedirectResult
Section intitulée “getRedirectResult”Renvoie le SignInResult à partir du flux de connexion basé sur la redirection.
Si la connexion n'a pas réussi, échoue avec une erreur. SignInResult Si aucune opération de redirection n'a été appelée, renvoie un
avec un utilisateur nul.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.getRedirectResult();getTenantId
Copier dans le presse-papierObtenez l'ID du locataire.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.getTenantId();isSignInWithEmailLink
Section intitulée “isSignInWithEmailLink”Vérifie si un lien entrant est un lien de connexion par e-mail approprié pour signInWithEmailLink.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.isSignInWithEmailLink({} as IsSignInWithEmailLinkOptions);linkWithApple
Section intitulée “linkWithApple”Liaison de la compte utilisateur avec le fournisseur d'authentification Apple.
L'utilisateur doit être connecté sur la couche native.
La skipNativeAuth option de configuration n'a aucun effet ici.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithApple();linkWithEmailAndPassword
Section intitulée “linkWithEmailAndPassword”Liaison de la compte utilisateur avec le fournisseur d'authentification Email.
L'utilisateur doit être connecté sur la couche native. skipNativeAuth L'option de configuration n'a pas d'effet ici.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithEmailAndPassword({} as LinkWithEmailAndPasswordOptions);linkWithEmailLink
Section intitulée “liens avec un lien e-mail”Liaison de l'adresse e-mail de l'utilisateur avec le fournisseur d'authentification par e-mail.
L'utilisateur doit être connecté sur la couche native. skipNativeAuth L'option de configuration n'a pas d'effet ici.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithEmailLink({} as LinkWithEmailLinkOptions);linkWithFacebook
Section intitulée “liens avec Facebook”Liaison de l'adresse e-mail de l'utilisateur avec le fournisseur d'authentification Facebook.
L'utilisateur doit être connecté sur la couche native. skipNativeAuth L'option de configuration n'a pas d'effet ici.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithFacebook();linkWithGameCenter
Section intitulée “linkWithGameCenter”Liaise l'account utilisateur avec le fournisseur d'authentification Game Center.
L'utilisateur doit être connecté sur la couche native.
La skipNativeAuth option de configuration n'a pas d'effet ici.
Disponible uniquement pour iOS.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithGameCenter();linkWithGithub
Section intitulée “linkWithGithub”Liaise l'account utilisateur avec GitHub fournisseur d'authentification.
L'utilisateur doit être connecté sur la couche native.
La skipNativeAuth option de configuration n'a pas d'effet ici.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithGithub();linkWithGoogle
Section intitulée “linkWithGoogle”S'associe le compte utilisateur au fournisseur d'authentification Google.
L'utilisateur doit être connecté sur la couche native.
La skipNativeAuth option de configuration n'a pas d'effet ici.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithGoogle();linkWithMicrosoft
Section intitulée “linkWithMicrosoft”S'associe le compte utilisateur au fournisseur d'authentification Microsoft.
L'utilisateur doit être connecté sur la couche native.
La skipNativeAuth option de configuration n'a pas d'effet ici.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithMicrosoft();linkWithOpenIdConnect
Section intitulée “linkWithOpenIdConnect”S'associe le compte utilisateur à un fournisseur OpenID Connect.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithOpenIdConnect({} as LinkWithOpenIdConnectOptions);linkWithPhoneNumber
Section intitulée “linkWithPhoneNumber”Liaise l'adresse e-mail de l'utilisateur avec le fournisseur d'authentification par numéro de téléphone.
L'utilisateur doit être connecté sur la couche native.
La skipNativeAuth option de configuration n'a aucun effet ici.
Utilisez le phoneVerificationCompleted écouteur pour être averti lorsque la vérification est terminée. phoneVerificationFailed Utilisez le phoneCodeSent écouteur pour être averti lorsque la vérification a échoué.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithPhoneNumber({} as LinkWithPhoneNumberOptions);linkWithPlayGames
écouteur pour obtenir l'ID de vérification.Copier dans le presse-papiers
L'utilisateur doit être connecté sur la couche native. skipNativeAuth L'option de configuration n'a aucun effet ici.
Disponible uniquement pour Android.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithPlayGames();linkWithTwitter
Section intitulée “linkWithTwitter”Liaise l'adresse e-mail de l'utilisateur avec le fournisseur d'authentification Twitter.
L'utilisateur doit être connecté sur la couche native. skipNativeAuth L'option de configuration n'a aucun effet ici.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithTwitter();linkWithYahoo
Section intitulée “linkWithYahoo”Liaise l'adresse e-mail de l'utilisateur avec le fournisseur d'authentification Yahoo.
L'utilisateur doit être connecté sur la couche native. skipNativeAuth Cette option de configuration n'a pas d'effet ici.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithYahoo();Recharge les données de compte utilisateur, si connecté.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.reload();revokeAccessToken
Section intitulée « révoquerAccessToken »Révoque le jeton d'accès spécifié. Actuellement, seul les jetons d'accès OAuth Apple sont pris en charge.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.revokeAccessToken({} as RevokeAccessTokenOptions);sendEmailVerification
Section intitulée « envoyerEmailVerification »Envoie un e-mail de vérification au utilisateur actuellement connecté.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.sendEmailVerification();sendPasswordResetEmail
Section intitulée « envoyerPasswordResetEmail »Envoie un courriel de réinitialisation de mot de passe.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.sendPasswordResetEmail({} as SendPasswordResetEmailOptions);sendSignInLinkToEmail
Section intitulée « envoyer un lien de connexion par courriel »Envoie un lien de connexion par courriel au utilisateur avec l'adresse e-mail spécifiée.
Pour terminer la connexion avec le lien de courriel, appelez signInWithEmailLink avec l'adresse e-mail et le lien de courriel fournis dans le courriel envoyé à l'utilisateur.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.sendSignInLinkToEmail({} as SendSignInLinkToEmailOptions);setLanguageCode
Section intitulée « definir le code de langue »Définit la langue utilisée par l'utilisateur code pour les opérations d'authentification.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.setLanguageCode({} as SetLanguageCodeOptions);setPersistence
Section intitulée « definir la persistance »Définit le type de persistance pour la session d'authentification actuellement enregistrée.
Seulement disponible pour le Web.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.setPersistence({} as SetPersistenceOptions);setTenantId
Section intitulée “setTenantId”Définit l'ID de locataire.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.setTenantId({} as SetTenantIdOptions);signInAnonymously
Section intitulée “signInAnonymously”Se connecte en tant qu'utilisateur anonyme.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInAnonymously();signInWithApple
Section intitulée “signInWithApple”Démarre le flux de connexion Apple.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithApple();signInWithCustomToken
Section intitulée “signInWithCustomToken”Démarre le flux de connexion personnalisé.
Cette méthode ne peut pas être utilisée en combinaison avec skipNativeAuth sur Android et iOS.
Dans ce cas, vous devez utiliser l'interface de la Firebase JS __CAPGO_KEEP_0__ directement. signInWithCustomToken interface of the Firebase JS SDK directly.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithCustomToken({} as SignInWithCustomTokenOptions);signInWithEmailAndPassword
Démarre le flux de connexion en utilisant un e-mail et un mot de passe.Copier dans le presse-papier
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithEmailAndPassword({} as SignInWithEmailAndPasswordOptions);signInWithEmailLink
Se connecte en utilisant un e-mail et un lien de connexion e-mail.Copier dans le presse-papier
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithEmailLink({} as SignInWithEmailLinkOptions);signInWithFacebook
Copier dans le presse-papierDémarre la progression de connexion Facebook.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithFacebook();signInWithGameCenter
Section intitulée “signInWithGameCenter”Démarre la progression de connexion Game Center.
Seulement disponible pour iOS.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithGameCenter();signInWithGithub
Section intitulée “signInWithGithub”Démarre la progression de connexion GitHub.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithGithub();signInWithGoogle
Section intitulée “signInWithGoogle”Démarre la progression de connexion Google.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithGoogle();signInWithMicrosoft
Section intitulée « seConnecterAvecMicrosoft »Démarre le flux de connexion Microsoft.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithMicrosoft();signInWithOpenIdConnect
Section intitulée « seConnecterAvecOpenIdConnect »Démarre le flux de connexion OpenID Connect.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithOpenIdConnect({} as SignInWithOpenIdConnectOptions);signInWithPhoneNumber
Section intitulée « seConnecterAvecLeNumeroDeTelephone »Démarre le flux de connexion en utilisant un numéro de téléphone.
Utilisez le phoneVerificationCompleted pour être notifié lorsque la vérification est terminée. phoneVerificationFailed pour être notifié lorsque la vérification a échoué. phoneCodeSent pour obtenir l'ID de vérification.
Disponible uniquement pour Android et iOS.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithPhoneNumber({} as SignInWithPhoneNumberOptions);signInWithPlayGames
Section intitulée “signInWithPlayGames”Démarre le flux de connexion à Play Games.
Disponible uniquement pour Android.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithPlayGames();signInWithTwitter
Section intitulée “signInWithTwitter”Démarre le flux de connexion à Twitter.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithTwitter();signInWithYahoo
Section intitulée “signInWithYahoo”Démarre le flux de connexion à Yahoo.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithYahoo();Démarre le flux de déconnexion.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signOut();Déconnecte un fournisseur d'un compte utilisateur.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.unlink({} as UnlinkOptions);updateEmail
Section intitulée “mettre à jour l'e-mail”Met à jour l'adresse e-mail du utilisateur connecté actuellement.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.updateEmail({} as UpdateEmailOptions);updatePassword
Section intitulée “mettre à jour le mot de passe”Met à jour le mot de passe de l'utilisateur connecté actuellement.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.updatePassword({} as UpdatePasswordOptions);updateProfile
Section intitulée « mise à jour de profil »Met à jour les données du profil de l'utilisateur.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.updateProfile({} as UpdateProfileOptions);Fixe la langue utilisée par l'utilisateur code comme langue par défaut de l’application.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.useAppLanguage();useEmulator
Section intitulée « utiliser l’émulateur »Instrumente votre application pour communiquer avec l’émulateur d’authentification.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.useEmulator({} as UseEmulatorOptions);verifyBeforeUpdateEmail
Section intitulée « vérifier avant mise à jour de l’adresse e-mail »Vérifie l’adresse e-mail nouvelle avant de mettre à jour l’adresse e-mail de l’utilisateur connecté actuellement.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.verifyBeforeUpdateEmail({} as VerifyBeforeUpdateEmailOptions);checkAppTrackingTransparencyPermission
Section intitulée “vérifiezLaTransparenceDeSuiviDeLApplication”Vérifiez l'état actuel de la transparence de suivi de l'application.
Seulement disponible sur iOS.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.checkAppTrackingTransparencyPermission();requestAppTrackingTransparencyPermission
Section intitulée “demandezLaTransparenceDeSuiviDeLApplication”Ouvre le dialogue système pour autoriser la transparence de suivi de l'application.
Attention : L'utilisateur peut avoir désactivé la demande de suivi dans les paramètres du dispositif, voir la documentation d'Apple.
Seulement disponible sur iOS.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.requestAppTrackingTransparencyPermission();Référence de type
Référence de typeApplyActionCodeOptions
Options d'application du code d'actionexport interface ApplyActionCodeOptions { /** * A verification code sent to the user. * * @since 0.2.2 */ oobCode: string;}ConfirmPasswordResetOptions
Options de confirmation de réinitialisation du mot de passeexport 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
Options de confirmation du code de vérificationexport 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
Résultat de connexionexport 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
Options de création d'un utilisateur avec un mot de passeexport interface CreateUserWithEmailAndPasswordOptions { /** * @since 0.2.2 */ email: string; /** * @since 0.2.2 */ password: string;}FetchSignInMethodsForEmailOptions
Options de récupération des méthodes de connexion pour l'adresse e-mailexport interface FetchSignInMethodsForEmailOptions { /** * The user's email address. * * @since 6.0.0 */ email: string;}FetchSignInMethodsForEmailResult
Section intitulée « Résultat de la méthode de connexion par e-mail »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 intitulée « Résultat de l'utilisateur actuel »export interface GetCurrentUserResult { /** * The currently signed-in user, or null if there isn't any. * * @since 0.1.0 */ user: User | null;}GetIdTokenOptions
Section intitulée « Options de jeton d'identification »export interface GetIdTokenOptions { /** * Force refresh regardless of token expiration. * * @since 0.1.0 */ forceRefresh: boolean;}GetIdTokenResult
Section intitulée « Résultat de jeton d'identification »export interface GetIdTokenResult { /** * The Firebase Auth ID token JWT string. * * @since 0.1.0 */ token: string;}GetIdTokenResultOptions
Section intitulée « Options de résultat de jeton d'identification »export interface GetIdTokenResultOptions { /** * Force refresh regardless of token expiration. * * @since 7.4.0 */ forceRefresh: boolean;}GetIdTokenResultResult
Section intitulée « Résultat du résultat de jeton d'identification »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 de Vérité
Section intitulée « Source de Vérité »Cette page est générée à partir du plugin’s src/definitions.tsRe-run the sync when the public API changes upstream.