Firebase Authenticationの__CAPGO_KEEP_0__リポジトリ
このプラグインのインストールステップとフルマークダウンガイドを含むセットアップの質問をコピーしてください。
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.
インストール
InstallAI-Assisted Setupを使用してプラグインをインストールすることができます。AIツールにCapgoスキルを追加するには、以下のコマンドを実行してください。
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins次に、以下のプロンプトを使用してください。
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-firebase-authentication` plugin in my project.Manual Setupを使用する場合は、以下のコマンドを実行してください。プラットフォーム固有の指示に従ってください。
bun add @capgo/capacitor-firebase-authenticationbunx cap syncインポート
インポートimport { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';API Overview
「API Overview」applyActionCode
「applyActionCode」code を適用します。code は、ユーザーにメールで送信された確認コードです。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.applyActionCode({} as ApplyActionCodeOptions);confirmPasswordReset
「confirmPasswordReset」__CAPGO_KEEP_0__ を完了します。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.confirmPasswordReset({} as ConfirmPasswordResetOptions);confirmVerificationCode
「confirmVerificationCode」__CAPGO_KEEP_0__ を完了します。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.confirmVerificationCode({} as ConfirmVerificationCodeOptions);createUserWithEmailAndPassword
「createUserWithEmailAndPassword」新しいユーザー アカウントを作成します。 新しいアカウントが作成された場合、ユーザーは自動的にログインされます。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.createUserWithEmailAndPassword({} as CreateUserWithEmailAndPasswordOptions);deleteUser
セクション “ユーザー削除”ユーザーを削除し、ログアウトします。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.deleteUser();fetchSignInMethodsForEmail
セクション “メールアドレスでサインイン方法を取得”メールアドレスでサインイン方法を取得します。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.fetchSignInMethodsForEmail({} as FetchSignInMethodsForEmailOptions);getCurrentUser
セクション “現在のユーザーを取得”現在のユーザーを取得します。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.getCurrentUser();getPendingAuthResult
セクション “認証結果を取得”取得する SignInResult アプリがウェブサインインフローを開始した場合、OSがアプリをバックグラウンドで消去した場合に返します。
Androidのみ利用可能です。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.getPendingAuthResult();getIdToken
「getIdToken」のセクション現在サインインしているユーザーのFirebase Auth IDトークンを取得します。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.getIdToken();getIdTokenResult
「getIdTokenResult」のセクションJSON Webトークン(JWT)をデシリアライズして、Firebaseサービスにユーザーを識別するために使用します。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.getIdTokenResult();getRedirectResult
「getRedirectResult」のセクション取得する SignInResult リダイレクトベースのサインインフローから。
サインインが失敗した場合、エラーで失敗します。
リダイレクト操作が呼び出されなかった場合、ユーザーがnullの場合を返します。 SignInResult ユーザーがnullの場合を返します。
Webのみ利用可能です。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.getRedirectResult();getTenantId
セクション「getTenantId」テナントIDを取得します。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.getTenantId();isSignInWithEmailLink
セクション「isSignInWithEmailLink」Incomingリンクがメールアドレスでサインインに適しているかどうかを確認します。 signInWithEmailLink.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.isSignInWithEmailLink({} as IsSignInWithEmailLinkOptions);linkWithApple
セクション「linkWithApple」Apple認証プロバイダとユーザーアカウントをリンクします。
ユーザーはネイティブレイヤーでログインしている必要があります。 skipNativeAuth この設定オプションはここでは効果がありません。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithApple();linkWithEmailAndPassword
「linkWithEmailAndPassword」セクションEmail認証プロバイダとユーザーアカウントをリンクします。
ユーザーはネイティブレイヤーでログインしている必要があります。 skipNativeAuth この設定オプションはここでは効果がありません。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithEmailAndPassword({} as LinkWithEmailAndPasswordOptions);linkWithEmailLink
「linkWithEmailLink」セクションEmail認証プロバイダとユーザーアカウントをリンクします。
ユーザーはネイティブレイヤーでログインしている必要があります。 skipNativeAuth 設定オプションはここでは効果を発揮しません。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithEmailLink({} as LinkWithEmailLinkOptions);linkWithFacebook
「linkWithFacebook」セクションFacebook認証プロバイダとユーザーアカウントをリンクします。
ユーザーはネイティブレイヤーでログインしている必要があります。
skipNativeAuth 設定オプションはここでは効果を発揮しません。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithFacebook();linkWithGameCenter
「linkWithGameCenter」セクションGame Center認証プロバイダとユーザーアカウントをリンクします。
ユーザーはネイティブレイヤーでログインしている必要があります。
skipNativeAuth 設定オプションはここでは効果を発揮しません。
iOSのみで利用可能です。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithGameCenter();linkWithGithub
「linkWithGithub」セクションユーザー アカウントをGitHub認証プロバイダとリンクします。
ユーザーはネイティブ層でログインしている必要があります。
skipNativeAuth ここではこの設定オプションは効果がありません。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithGithub();linkWithGoogle
「linkWithGoogle」セクションユーザー アカウントをGoogle認証プロバイダとリンクします。
ユーザーはネイティブ層でログインしている必要があります。
skipNativeAuth ここではこの設定オプションは効果がありません。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithGoogle();linkWithMicrosoft
「linkWithMicrosoft」セクションMicrosoft認証プロバイダとユーザーアカウントをリンクします。
ユーザーはネイティブレイヤーでログインしている必要があります。 skipNativeAuth ここではこの設定オプションは効果がありません。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithMicrosoft();linkWithOpenIdConnect
「linkWithOpenIdConnect」セクションOpenID Connectプロバイダとユーザーアカウントをリンクします。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithOpenIdConnect({} as LinkWithOpenIdConnectOptions);linkWithPhoneNumber
「linkWithPhoneNumber」セクション電話番号認証プロバイダとユーザーアカウントをリンクします。
ユーザーはネイティブレイヤーでログインしている必要があります。 skipNativeAuth ここではこの設定オプションは効果がありません。
Capgoを使用して phoneVerificationCompleted 通知待ち phoneVerificationFailed 失敗通知待ち phoneCodeSent 認証ID取得
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithPhoneNumber({} as LinkWithPhoneNumberOptions);linkWithPlayGames
「linkWithPlayGames」Play Games認証プロバイダとユーザーアカウントをリンクします。
ユーザーはネイティブレイヤーでログインしている必要があります。 skipNativeAuth この設定オプションはここでは効果がありません。
Androidのみ
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithPlayGames();linkWithTwitter
「linkWithTwitter」Twitter認証プロバイダとユーザーアカウントをリンクします。
ユーザーはネイティブレイヤーでログインしている必要があります。
skipNativeAuth ここではこの設定オプションの影響はありません。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithTwitter();linkWithYahoo
「linkWithYahoo」セクションYahoo 認証プロバイダとユーザーアカウントをリンクします。
ユーザーはネイティブレイヤーでログインしている必要があります。
skipNativeAuth ここではこの設定オプションの影響はありません。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithYahoo();reload
「reload」セクションユーザーアカウントデータを再読み込みします。ログインしている場合。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.reload();revokeAccessToken
「revokeAccessToken」セクションアクセストークンを取り消します。現在はApple OAuthアクセストークンのみをサポートしています。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.revokeAccessToken({} as RevokeAccessTokenOptions);sendEmailVerification
セクション “sendEmailVerification”現在のユーザーに確認メールを送信します。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.sendEmailVerification();sendPasswordResetEmail
セクション “sendPasswordResetEmail”パスワードをリセットするメールを送信します。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.sendPasswordResetEmail({} as SendPasswordResetEmailOptions);sendSignInLinkToEmail
セクション “sendSignInLinkToEmail”指定されたメールアドレスにサインイン用のメールリンクを送信します。
サインイン用のメールリンクを使用してサインインを完了するには、 signInWithEmailLink メールアドレスとメールリンクを指定して呼び出してください。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.sendSignInLinkToEmail({} as SendSignInLinkToEmailOptions);setLanguageCode
「setLanguageCode」のセクションcodeのためのユーザーフェイス言語を設定します。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.setLanguageCode({} as SetLanguageCodeOptions);setPersistence
「setPersistence」のセクション現在の認証セッションの保存方法を設定します。
Webのみで利用可能
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.setPersistence({} as SetPersistenceOptions);setTenantId
「setTenantId」のセクションテナントIDを設定します。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.setTenantId({} as SetTenantIdOptions);signInAnonymously
「signInAnonymously」のセクション匿名ユーザーとしてサインインします。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInAnonymously();signInWithApple
「signInWithApple」セクションApple サインインフローを開始します。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithApple();signInWithCustomToken
「signInWithCustomToken」セクションカスタム トークン サインインフローを開始します。
Android と iOS でこのメソッドを組み合わせることはできません。
この場合、Firebase JS __CAPGO_KEEP_0__ のインターフェイスを直接使用する必要があります。 skipNativeAuth クリップボードにコピー signInWithCustomToken interface of the Firebase JS SDK directly.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithCustomToken({} as SignInWithCustomTokenOptions);signInWithEmailAndPassword
pagePathメールアドレスとパスワードを使用したサインインフローを開始します。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithEmailAndPassword({} as SignInWithEmailAndPasswordOptions);signInWithEmailLink
「signInWithEmailLink」セクションメールアドレスとサインインメールリンクを使用したサインイン
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithEmailLink({} as SignInWithEmailLinkOptions);signInWithFacebook
「signInWithFacebook」セクションFacebookサインインフローを開始します。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithFacebook();signInWithGameCenter
「signInWithGameCenter」セクションゲームセンターのサインインフローを開始します。
iOSのみで利用可能です。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithGameCenter();signInWithGithub
GitHubでサインインGitHubのサインインフローを開始します。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithGithub();signInWithGoogle
GoogleでサインインGoogleのサインインフローを開始します。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithGoogle();signInWithMicrosoft
MicrosoftでサインインMicrosoftのサインインフローを開始します。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithMicrosoft();signInWithOpenIdConnect
OpenID ConnectでサインインOpenID Connectのサインインフローを開始します。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithOpenIdConnect({} as SignInWithOpenIdConnectOptions);signInWithPhoneNumber
「signInWithPhoneNumber」セクション電話番号を使用してサインインフローを開始します。
「verificationCompleted」リスナーを使用して、検証が完了されたときに通知を受けます。 phoneVerificationCompleted 「verificationFailed」リスナーを使用して、検証が失敗したときに通知を受けます。 phoneVerificationFailed 「verificationId」リスナーを使用して、検証IDを取得します。 phoneCodeSent AndroidおよびiOSのみで利用可能です。
コピー
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithPhoneNumber({} as SignInWithPhoneNumberOptions);signInWithPlayGames
Play Gamesサインインフローを開始します。Androidのみで利用可能です。
コピー
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithPlayGames();signInWithTwitter
TwitterでサインインするTwitterでサインインのフローを開始します。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithTwitter();signInWithYahoo
YahooでサインインするYahooでサインインのフローを開始します。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithYahoo();signOut
サインアウトするサインアウトのフローを開始します。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signOut();unlink
プロバイダーをユーザーアカウントから削除するクリップボードにコピー
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.unlink({} as UnlinkOptions);updateEmail
「updateEmail」セクション現在ログイン中のユーザーのメールアドレスを更新します。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.updateEmail({} as UpdateEmailOptions);updatePassword
「updatePassword」セクション現在ログイン中のユーザーのパスワードを更新します。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.updatePassword({} as UpdatePasswordOptions);updateProfile
「updateProfile」セクションユーザーのプロファイルデータを更新します。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.updateProfile({} as UpdateProfileOptions);useAppLanguage
「useAppLanguage」セクションSets the user-facing language code to be the default app language.
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.useAppLanguage();useEmulator
useEmulator”のセクションAuthentication エミュレータとアプリを接続する
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.useEmulator({} as UseEmulatorOptions);verifyBeforeUpdateEmail
verifyBeforeUpdateEmail”のセクション現在ログイン中のユーザーのメールアドレスを更新する前に、新しいメールアドレスを検証します。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.verifyBeforeUpdateEmail({} as VerifyBeforeUpdateEmailOptions);checkAppTrackingTransparencyPermission
checkAppTrackingTransparencyPermission”のセクションアプリのトラッキング透明性の現在の状態を確認します。
iOSのみ
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.checkAppTrackingTransparencyPermission();requestAppTrackingTransparencyPermission
requestAppTrackingTransparencyPermission”のセクションシステムダイアログを開いてアプリのトラッキング透明性の許可を求めます。
注意: ユーザーは、デバイスの設定でトラッキングリクエストを無効にしている可能性があります。詳しくは Appleのドキュメント.
iOSのみで利用可能です。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.requestAppTrackingTransparencyPermission();型参照
「型参照」のセクションApplyActionCodeOptions
「ApplyActionCodeOptions」のセクションexport interface ApplyActionCodeOptions { /** * A verification code sent to the user. * * @since 0.2.2 */ oobCode: string;}ConfirmPasswordResetOptions
「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
「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
「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
「CreateUserWithEmailAndPasswordOptions」セクションexport interface CreateUserWithEmailAndPasswordOptions { /** * @since 0.2.2 */ email: string; /** * @since 0.2.2 */ password: string;}FetchSignInMethodsForEmailOptions
「FetchSignInMethodsForEmailOptions」セクションexport interface FetchSignInMethodsForEmailOptions { /** * The user's email address. * * @since 6.0.0 */ email: string;}FetchSignInMethodsForEmailResult
「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
「GetCurrentUserResult」セクションexport interface GetCurrentUserResult { /** * The currently signed-in user, or null if there isn't any. * * @since 0.1.0 */ user: User | null;}GetIdTokenOptions
「GetIdTokenOptions」セクションexport interface GetIdTokenOptions { /** * Force refresh regardless of token expiration. * * @since 0.1.0 */ forceRefresh: boolean;}GetIdTokenResult
「GetIdTokenResult」のセクションexport interface GetIdTokenResult { /** * The Firebase Auth ID token JWT string. * * @since 0.1.0 */ token: string;}GetIdTokenResultOptions
「GetIdTokenResultOptions」のセクションexport interface GetIdTokenResultOptions { /** * Force refresh regardless of token expiration. * * @since 7.4.0 */ forceRefresh: boolean;}GetIdTokenResultResult
「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>;}真実の源
「真実の源」のセクションこのページはプラグインの src/definitions.tsパブリックAPIがアップストリームで変更されたときに再度同期してください。
「Getting Started」から続けてください
「Getting Started」から続けてくださいあなたが使用している場合 Getting Started 認証とアカウントフローの計画に使用している場合 @capgo/capacitor-social-login @capgo/capacitor-social-loginの実装詳細 @capgo/capacitor-passkey @capgo/capacitor-passkeyの実装詳細 @capgo/capacitor-native-biometric @capgo/capacitor-native-biometricの実装詳細 2要素認証 2要素認証の実装詳細 SSO (Enterprise) SSO (Enterprise)の実装詳細については