Passer à la navigation

Démarrage

GitHub

Vous pouvez utiliser notre configuration assistée par l'IA pour installer le plugin. Ajoutez les Capgo compétences à votre outil IA à l'aide de la commande suivante :

Fenêtre de terminal
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins

Ensuite, utilisez la prompt suivante :

Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-firebase-authentication` plugin in my project.

Si vous préférez la configuration manuelle, installez le plugin en exécutant les commandes suivantes et suivez les instructions spécifiques au plateforme ci-dessous :

Fenêtre de terminal
bun add @capgo/capacitor-firebase-authentication
bunx cap sync
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';

Applies a verification code sent to the user by email.

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.applyActionCode({} as ApplyActionCodeOptions);

Termine le processus de réinitialisation du mot de passe.

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.confirmPasswordReset({} as ConfirmPasswordResetOptions);

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);

Crée un nouveau compte utilisateur avec un adresse e-mail et un 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);

Supprime et déconnecte l'utilisateur.

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.deleteUser();

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);

Récupère l'utilisateur actuellement connecté.

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.getCurrentUser();

Renvoie le SignInResult Si votre application a lancé un flux de connexion en ligne et que le système nettoie l'application pendant que celle-ci est en arrière-plan.

Seulement disponible pour Android.

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.getPendingAuthResult();

Récupère le jeton d'authentification Firebase ID pour l'utilisateur actuellement connecté.

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.getIdToken();

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();

Renvoie le SignInResult à partir de la procédure de connexion basée sur la redirection.

Si la connexion n'a pas réussi, échoue avec une erreur. Si aucune opération de redirection n'a été appelée, retourne un SignInResult avec un utilisateur null.

Seul disponible pour Web.

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.getRedirectResult();

Obtenez l'ID de locataire.

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.getTenantId();

Vérifiez si un lien entrant est une connexion avec lien e-mail approprié pour signInWithEmailLink.

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.isSignInWithEmailLink({} as IsSignInWithEmailLinkOptions);

Lié l'account utilisateur avec le fournisseur d'authentification Apple.

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.linkWithApple();

Lié l'account 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);

Lié l'account utilisateur avec le fournisseur d'authentification Email.

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.linkWithEmailLink({} as LinkWithEmailLinkOptions);

Liaise l'account utilisateur avec le fournisseur d'authentification Facebook.

L'utilisateur doit être connecté sur la couche native. La skipNativeAuth Cette option de configuration n'a pas d'effet ici.

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithFacebook();

Liaise l'account utilisateur avec le fournisseur d'authentification Game Center.

L'utilisateur doit être connecté sur la couche native. La skipNativeAuth Cette option de configuration n'a pas d'effet ici.

Seulement disponible pour iOS.

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithGameCenter();

Liaise l'adresse e-mail de l'utilisateur avec le fournisseur d'authentification GitHub.

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();

Liaise l'adresse e-mail de l'utilisateur avec le 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();

Lié l'account utilisateur avec le fournisseur d'authentification Microsoft.

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.linkWithMicrosoft();

Lié l'account utilisateur avec un fournisseur OpenID Connect.

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithOpenIdConnect({} as LinkWithOpenIdConnectOptions);

Lié l'account utilisateur avec le fournisseur d'authentification par numéro de téléphone.

L’utilisateur doit être connecté sur la couche native. skipNativeAuth L’option de configuration n'a pas d'effet ici.

Utilisez le phoneVerificationCompleted écouteur pour être notifié lorsque la vérification est terminée. Utilisez le phoneVerificationFailed écouteur pour être notifié lorsque la vérification a échoué. Utilisez le phoneCodeSent écouteur pour obtenir l'ID de vérification.

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithPhoneNumber({} as LinkWithPhoneNumberOptions);

Liaise l'account utilisateur avec le fournisseur d'authentification Play Games.

L'utilisateur doit être connecté sur la couche native. skipNativeAuth La configuration n'a pas d'effet ici.

Seulement disponible pour Android.

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithPlayGames();

Liaise l'account utilisateur avec le fournisseur d'authentification Twitter.

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.linkWithTwitter();

Liaise l'account utilisateur avec le fournisseur d'authentification Yahoo.

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.linkWithYahoo();

Recharge les données de compte utilisateur, si connecté.

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.reload();

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);

Envoie un e-mail de vérification à l'utilisateur actuellement connecté.

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.sendEmailVerification();

Envoie un e-mail de réinitialisation de mot de passe.

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.sendPasswordResetEmail({} as SendPasswordResetEmailOptions);

Envoie un lien d'inscription par e-mail à l'utilisateur avec l'adresse e-mail spécifiée.

Pour compléter l'inscription avec le lien e-mail, appelez signInWithEmailLink avec l'adresse e-mail et le lien e-mail fournis dans l'e-mail envoyé à l'utilisateur.

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.sendSignInLinkToEmail({} as SendSignInLinkToEmailOptions);

Sets the user-facing language code for auth operations.

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.setLanguageCode({} as SetLanguageCodeOptions);

Définit le type de persistance pour la session d'authentification enregistrée actuellement.

Disponible uniquement pour Web.

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.setPersistence({} as SetPersistenceOptions);

Définit l'ID du locataire.

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.setTenantId({} as SetTenantIdOptions);

Se connecte en tant qu'utilisateur anonyme.

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInAnonymously();

Démarre le flux de connexion Apple.

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithApple();

Démarre le flux de connexion avec un jeton 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 du 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);

Démarre la procédure de connexion à l'aide d'un adresse e-mail et d'un mot de passe.

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithEmailAndPassword({} as SignInWithEmailAndPasswordOptions);

Se connecte à l'aide d'un adresse e-mail et d'un lien de connexion.

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithEmailLink({} as SignInWithEmailLinkOptions);

Démarre la procédure de connexion Facebook.

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithFacebook();

Démarre la procédure de connexion Game Center.

Disponible uniquement pour iOS.

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithGameCenter();

Démarrer le flux de connexion GitHub.

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithGithub();

Démarrer le flux de connexion Google.

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithGoogle();

Démarrer le flux de connexion Microsoft.

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithMicrosoft();

Démarrer le flux de connexion OpenID Connect.

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithOpenIdConnect({} as SignInWithOpenIdConnectOptions);

Démarrer le flux de connexion à l'aide d'un numéro de téléphone.

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é.

Utilisez le

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithPhoneNumber({} as SignInWithPhoneNumberOptions);

Copier dans le presse-papier

Section intitulée « signInWithPlayGames »

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithPlayGames();

Démarre le flux de connexion Twitter.

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithTwitter();

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);

Met à jour l'adresse e-mail de l'utilisateur actuellement connecté.

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.updateEmail({} as UpdateEmailOptions);

Met à jour le mot de passe de l'utilisateur actuellement connecté.

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.updatePassword({} as UpdatePasswordOptions);

Met à jour les données de profil d'un utilisateur.

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.updateProfile({} as UpdateProfileOptions);

Sets the user-facing language code to be the default app language.

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.useAppLanguage();

Configurez votre application pour communiquer avec l'émulateur d'authentification.

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.useEmulator({} as UseEmulatorOptions);

Vérifiez l'adresse e-mail nouvelle avant de mettre à jour l'adresse e-mail de l'utilisateur actuellement connecté.

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.verifyBeforeUpdateEmail({} as VerifyBeforeUpdateEmailOptions);

Vérifiez l'état actuel de la transparence de suivi de l'application.

Disponible uniquement sur iOS.

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.checkAppTrackingTransparencyPermission();

Ouvrez 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 appareil, voir la documentation d'Apple.

Disponible uniquement sur iOS.

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.requestAppTrackingTransparencyPermission();
export interface ApplyActionCodeOptions {
/**
* A verification code sent to the user.
*
* @since 0.2.2
*/
oobCode: string;
}
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;
}
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;
}
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;
}
export interface CreateUserWithEmailAndPasswordOptions {
/**
* @since 0.2.2
*/
email: string;
/**
* @since 0.2.2
*/
password: string;
}
export interface FetchSignInMethodsForEmailOptions {
/**
* The user's email address.
*
* @since 6.0.0
*/
email: string;
}
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[];
}
export interface GetCurrentUserResult {
/**
* The currently signed-in user, or null if there isn't any.
*
* @since 0.1.0
*/
user: User | null;
}
export interface GetIdTokenOptions {
/**
* Force refresh regardless of token expiration.
*
* @since 0.1.0
*/
forceRefresh: boolean;
}
export interface GetIdTokenResult {
/**
* The Firebase Auth ID token JWT string.
*
* @since 0.1.0
*/
token: string;
}
export interface GetIdTokenResultOptions {
/**
* Force refresh regardless of token expiration.
*
* @since 7.4.0
*/
forceRefresh: boolean;
}
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>;
}

Cette page est générée à partir du plugin’s src/definitions.tsRe-run la synchronisation lorsque le public API change en amont.

Continuez de la page d'accueil « Getting Started »

Section intitulée « Continuez de l'Accueil »

Si vous utilisez Accueil pour planifier l'authentification et les flux de compte, connectez-l’avec @capgo/capacitor-connexion-social pour les détails d'implémentation dans @capgo/capacitor-connexion-social, @capgo/capacitor-mot-de-passe pour les détails d'implémentation dans @capgo/capacitor-mot-de-passe, @capgo/capacitor-authentification-native pour les détails d'implémentation dans @capgo/capacitor-authentification-native, Authentification à deux facteurs pour les détails d'implémentation dans l'authentification à deux facteurs, et SSO (Entreprise) pour les détails d'implémentation dans SSO (Entreprise).