はじめに
インストール手順とフル マークダウン ガイドが含まれるセットアップの質問をコピーします。
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.
インストール
「インストール」を選択bun add @capgo/capacitor-firebase-authenticationbunx cap syncインポート
「インポート」を選択import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';APIの概要
「APIの概要」を選択applyActionCode
「applyActionCode」を選択codeを確認する
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.applyActionCode({} as ApplyActionCodeOptions);confirmPasswordReset
「confirmPasswordReset」を選択パスワードリセットプロセスを完了します。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.confirmPasswordReset({} as ConfirmPasswordResetOptions);confirmVerificationCode
確認用の認証コードを確認するセクション電話番号の検証プロセスを完了します。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.confirmVerificationCode({} as ConfirmVerificationCodeOptions);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
「getCurrentUser」セクション現在サインインしているユーザーを取得します。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.getCurrentUser();getPendingAuthResult
「getPendingAuthResult」セクション返します。 SignInResult アプリがWebサインインフローを開始し、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セクションユーザーをFirebaseサービスに識別するために使用される、デシリアライズされたJSON Web Token (JWT)を返します。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.getIdTokenResult();getRedirectResult
getRedirectResultセクションリダイレクトベースのサインインフローから SignInResult サインインが失敗した場合、エラーで失敗します。
リダイレクトオペレーションが呼び出されなかった場合、ユーザーがnullの場合に返されます。
Only available for Web. SignInResult クリップボードにコピー
getTenantIdセクション
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.getRedirectResult();getTenantId
getRedirectResultメソッドは、リダイレクトベースのサインインフローからテナントIDを取得します。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.getTenantId();isSignInWithEmailLink
「isSignInWithEmailLink」セクションメールアドレスでサインインするためのリンクが適切かどうかを確認します。 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
「Email連携」セクションEmail認証プロバイダとユーザーアカウントをリンクします。
ユーザーはネイティブ層でログインしている必要があります。 skipNativeAuth この設定オプションはここでは効果がありません。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithEmailLink({} as LinkWithEmailLinkOptions);linkWithFacebook
「Facebook連携」セクション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
GoogleとリンクするGoogle認証プロバイダーとユーザーアカウントをリンクします。
ネイティブレイヤーでログインしている必要があります。
skipNativeAuth このセクションでは、設定オプションの影響はありません。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithGoogle();linkWithMicrosoft
MicrosoftとリンクするMicrosoft認証プロバイダーとユーザーアカウントをリンクします。
ネイティブレイヤーでログインしている必要があります。
skipNativeAuth このセクションでは、設定オプションの影響はありません。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithMicrosoft();linkWithOpenIdConnect
OpenID ConnectとリンクするOpenID Connect認証プロバイダーとユーザーアカウントをリンクします。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithOpenIdConnect({} as LinkWithOpenIdConnectOptions);linkWithPhoneNumber
「linkWithPhoneNumber」セクション電話番号認証プロバイダーとユーザーアカウントをリンクします。
ネイティブレイヤーでログインしている必要があります。
skipNativeAuth この設定オプションはここでは効果がありません。
検証が完了したときに通知を受け取るためのリスナーを使用してください。 phoneVerificationCompleted 検証が失敗したときに通知を受け取るためのリスナーを使用してください。 phoneVerificationFailed 検証IDを取得するためのリスナーを使用してください。 phoneCodeSent クリップボードにコピー
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithPhoneNumber({} as LinkWithPhoneNumberOptions);linkWithPlayGames
Play Games認証プロバイダーとユーザーアカウントをリンクします。Section titled “linkWithApple”
native層でログインしている必要があります。
skipNativeAuth この設定オプションはここでは効果がありません。
Androidのみ対応です。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithPlayGames();linkWithTwitter
「linkWithTwitter」セクションTwitter認証プロバイダとユーザーアカウントをリンクします。
native層でログインしている必要があります。
skipNativeAuth この設定オプションはここでは効果がありません。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithTwitter();linkWithYahoo
「linkWithYahoo」セクションYahoo認証プロバイダとユーザーアカウントをリンクします。
native層でログインしている必要があります。
skipNativeAuth __CAPGO_KEEP_0__はここでは効果がありません。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.linkWithYahoo();reload
「再読み込み」のセクションサインインしている場合、ユーザーアカウントデータを再読み込みします。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.reload();revokeAccessToken
「アクセストークンを取り消す」のセクション指定されたアクセストークンを取り消します。現在はApple OAuthアクセストークンのみをサポートしています。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.revokeAccessToken({} as RevokeAccessTokenOptions);sendEmailVerification
「メールの確認を送信する」のセクション現在サインインしているユーザーにメールの確認を送信します。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.sendEmailVerification();sendPasswordResetEmail
「パスワードをリセットするメールを送信する」のセクションパスワードリセットメールを送信します。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.sendPasswordResetEmail({} as SendPasswordResetEmailOptions);sendSignInLinkToEmail
「送信リンクをメールに送信する」セクション指定されたメールアドレスのユーザーに送信リンクを含むサインインメールを送信します。
メールリンクでサインインを完了するには、次の呼び出しを行ってください。 signInWithEmailLink 指定されたメールアドレスとメールに含まれるメールリンクを使用してください。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.sendSignInLinkToEmail({} as SendSignInLinkToEmailOptions);setLanguageCode
「言語コードを設定する」セクション認証オペレーションでユーザーに表示される言語codeを設定します。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.setLanguageCode({} as SetLanguageCodeOptions);setPersistence
「セッションの永続化を設定する」セクション現在保存されている認証セッションの永続化の種類を設定します。
Only available for 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
コピー「signInWithEmailLink」セクション
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithEmailAndPassword({} as SignInWithEmailAndPasswordOptions);signInWithEmailLink
コピー「signInWithFacebook」セクション
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithEmailLink({} as SignInWithEmailLinkOptions);signInWithFacebook
「signInWithGoogle」セクションFacebookでサインインのフローを開始します。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithFacebook();signInWithGameCenter
「Game Centerでサインイン」をタイトルにしたセクションGame Centerでサインインのフローを開始します。
iOSのみで利用可能です。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithGameCenter();signInWithGithub
「GitHubでサインイン」をタイトルにしたセクションStarts the GitHub sign-in flow.
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
「電話番号でサインイン」を開始します。検証が完了したときに通知を受け取るリスナーを使用してください。
検証が失敗したときに通知を受け取るリスナーを使用してください。 phoneVerificationCompleted 検証IDを取得するリスナーを使用してください。 phoneVerificationFailed 検証IDを取得するリスナーを使用してください。 phoneCodeSent 検証が完了したときに通知を受け取るリスナーを使用してください。
AndroidおよびiOSのみ対応。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithPhoneNumber({} as SignInWithPhoneNumberOptions);signInWithPlayGames
「signInWithPlayGames」セクションPlay Gamesのサインインフローを開始します。
Androidのみ対応。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithPlayGames();signInWithTwitter
「signInWithTwitter」セクションTwitterのサインインフローを開始します。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.signInWithTwitter();signInWithYahoo
「signInWithYahoo」セクション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
クリップボードにコピー現在サインインしているユーザーのパスワードを更新
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.updateEmail({} as UpdateEmailOptions);updatePassword
__CAPGO_KEEP_0____CAPGO_KEEP_1__
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.updatePassword({} as UpdatePasswordOptions);updateProfile
プロファイルを更新するユーザーのプロファイルデータを更新します。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.updateProfile({} as UpdateProfileOptions);useAppLanguage
アプリの言語を設定するアプリの言語を code に設定します。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.useAppLanguage();useEmulator
エミュレータを使用するアプリをエミュレータと通信するように設定します。
import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';
await FirebaseAuthentication.useEmulator({} as UseEmulatorOptions);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();Type Reference
種類の参照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 がアップストリームで変更された場合に再度同期を実行してください。