メインコンテンツにジャンプ
@capgo/capacitor-firebase-authentication 認証 & セキュリティ オープンソース

Firebase Authentication Capacitor プラグイン

Capacitor プラグイン (Firebase 認証)

インストール

bun add @capgo/capacitor-firebase-authentication bunx cap sync
npm、pnpm または yarn
  • npm install @capgo/capacitor-firebase-authentication
  • pnpm add @capgo/capacitor-firebase-authentication
  • yarn add @capgo/capacitor-firebase-authentication

ガイド

How to use Firebase Authentication in Capacitor

@capgo/capacitor-firebase-authentication

CapgoのCapacitorプラグインは、Firebase Authenticationをサポートしています。

インストール

bun add @capgo/capacitor-firebase-authentication
bunx cap sync

bunx cap sync プラグインのネイティブ code をあなたのネイティブ プロジェクトにコピーします。プラグインのアップグレード後は再度実行してください。

インポート

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';

API を一目で

方法 説明
applyActionCode ユーザーにメールで送られた検証 code を適用します。
confirmPasswordReset パスワードリセットプロセスを完了します。
confirmVerificationCode 電話番号検証プロセスを完了します。
createUserWithEmailAndPassword メールアドレスとパスワードで新しいユーザーアカウントを作成します。新しいアカウントが作成された場合、ユーザーは自動的にログインします。
deleteUser ユーザーを削除し、ログアウトします。
fetchSignInMethodsForEmail メールアドレスに対してサインイン方法を取得します。
getCurrentUser 現在ログインしているユーザーを取得します。
getPendingAuthResult リターンします。 SignInResult アプリがWebサインインフローを実行した場合に、OSがアプリをバックグラウンドでクリーンアップした場合に返します。
getIdToken 現在サインインしているユーザーのFirebase Auth IDトークンを取得します。
getIdTokenResult Firebaseサービスにユーザーを識別するために使用される、デシリアライズされたJSON Webトークン (JWT) を返します。
getRedirectResult リターンします。 SignInResult リダイレクトベースのサインインフローから取得します。
getTenantId テナントIDを取得します。
isSignInWithEmailLink メールアドレスでサインインするためのリンクが、以下の条件を満たしている場合にチェックします。 signInWithEmailLink.
linkWithApple Apple認証プロバイダとユーザーアカウントをリンクします。
linkWithEmailAndPassword Email認証プロバイダとユーザーアカウントをリンクします。
linkWithEmailLink Email認証プロバイダとユーザーアカウントをリンクします。
linkWithFacebook Facebook認証プロバイダとユーザーアカウントをリンクします。
linkWithGameCenter Game Center認証プロバイダとユーザーアカウントをリンクします。
linkWithGithub GitHub認証プロバイダとユーザーアカウントをリンクします。
linkWithGoogle Google認証プロバイダとユーザーアカウントをリンクします。
linkWithMicrosoft Microsoft認証プロバイダとユーザーアカウントをリンクします。
linkWithOpenIdConnect OpenID Connectプロバイダとユーザーアカウントをリンクします。
linkWithPhoneNumber 電話番号認証プロバイダとユーザーアカウントをリンクします。
linkWithPlayGames Play Games認証プロバイダとユーザーアカウントをリンクします。
linkWithTwitter Twitter認証プロバイダとユーザーアカウントをリンクします。
linkWithYahoo Yahoo認証プロバイダとユーザーアカウントをリンクします。
reload サインインしている場合にユーザーアカウントデータを再読み込みします。
revokeAccessToken 指定されたアクセストークンを取り消します。現在はApple OAuthアクセストークンのみをサポートしています。
sendEmailVerification 現在サインインしているユーザーに確認メールを送信します。
sendPasswordResetEmail パスワードリセットメールを送信します。
sendSignInLinkToEmail 指定されたメールアドレスのユーザーにサインインメールリンクを送信します。
setLanguageCode 認証操作で使用するユーザー向け言語を code に設定します。
setPersistence 現在保存されている認証セッションの保存方法を設定します。
setTenantId テナントIDを設定します。
signInAnonymously 匿名ユーザーとしてサインインします。
signInWithApple Appleサインインフローを開始します。
signInWithCustomToken カスタムトークンサインインフローを開始します。
signInWithEmailAndPassword メールアドレスとパスワードを使用してサインインフローを開始します。
signInWithEmailLink メールアドレスとサインインメールリンクを使用してサインインします。
signInWithFacebook Facebookサインインフローを開始します。
signInWithGameCenter Game Centerサインインフローを開始します。
signInWithGithub GitHubのサインインフローを開始します。
signInWithGoogle Googleのサインインフローを開始します。
signInWithMicrosoft Microsoftのサインインフローを開始します。
signInWithOpenIdConnect OpenID Connectのサインインフローを開始します。
signInWithPhoneNumber 電話番号を使用したサインインフローを開始します。
signInWithPlayGames Play Gamesのサインインフローを開始します。
signInWithTwitter Twitterのサインインフローを開始します。
signInWithYahoo Yahooのサインインフローを開始します。
signOut サインアウトフローを開始します。
unlink プロバイダーをユーザーアカウントから削除します。
updateEmail 現在サインインしているユーザーのメールアドレスを更新します。
updatePassword 現在サインインしているユーザーのパスワードを更新します。
updateProfile ユーザープロファイルデータを更新します。
useAppLanguage ユーザー向けの言語をcodeをデフォルトのアプリ言語に設定します。
useEmulator アプリをAuthenticationエミュレータと通信するように設定します。
verifyBeforeUpdateEmail 現在ログインしているユーザーのメールアドレスを更新する前に、新しいメールアドレスを検証します。
checkAppTrackingTransparencyPermission アプリのトラッキング透明性の現在のステータスを確認します。
requestAppTrackingTransparencyPermission アプリのトラッキング透明性の許可を求めるシステムダイアログを開きます。

例

applyActionCode()

メールで送られた検証用のcodeを適用します。

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';

await FirebaseAuthentication.applyActionCode({ oobCode: 'oob-code' });

confirmPasswordReset()

ユーザーに送信されたメールで送信された検証__CAPGO_KEEP_0__を適用します。

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';

await FirebaseAuthentication.confirmPasswordReset({
  oobCode: 'oob-code',
  newPassword: 'new-password',
});

confirmVerificationCode()

パスワードリセットプロセスを完了します。

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';

const result = await FirebaseAuthentication.confirmVerificationCode({
  verificationId: 'phoneCodeSent',
  verificationCode: 'phoneCodeSent',
});
// The result holds sensitive values: use it without logging it.

createUserWithEmailAndPassword()

電話番号検証プロセスを完了します。

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';

const result = await FirebaseAuthentication.createUserWithEmailAndPassword({
  email: 'user@example.com',
  password: 'password',
});
// The result holds sensitive values: use it without logging it.

deleteUser()

メールアドレスとパスワードを使用して新しいユーザーアカウントを作成します。新しいアカウントが作成された場合、ユーザーは自動的にログインします。

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';

await FirebaseAuthentication.deleteUser();

fetchSignInMethodsForEmail()

メールアドレスのサインイン方法を取得します。

import { FirebaseAuthentication } from '@capgo/capacitor-firebase-authentication';

const result = await FirebaseAuthentication.fetchSignInMethodsForEmail({ email: 'user@example.com' });
console.log(result);

上の表には、59のコアメソッドがリストされています。リスナーとバージョンヘルパー、各メソッドのフルコントラクトは、以下の__CAPGO_KEEP_0__リポジトリにドキュメントされています。 GitHub リポジトリ.

イベントをリスンする

addListener ハンドルを返します。画面がアンマウントされたとき、またはリスナーをすべてクリアしたいときは handle.remove() clear()を呼び出してください。 FirebaseAuthentication.removeAllListeners() フルリファレンス

ドキュメント

@capgo/capacitor-firebase-authentication

Capgoを使用している場合 @capgo/capacitor-firebase-authenticationを使用 authenticationを計画し、会員フローを接続するには @capgo/capacitor-ソーシャルログイン ソーシャルログインの実装詳細のために@capgo/capacitor-ソーシャルログイン @capgo/capacitor-パスキー @capgo/capacitor-パスキー実装詳細のために capgo/capacitor-native-biometric for the implementation detail in @capgo/capacitor-native-biometric, 二要素認証 for the implementation detail in Two-factor authentication, and SSO (Enterprise) CapgoのSSO (Enterprise)実装の詳細について。

FAQ

Firebase Authentication プラグイン FAQ

Firebase Authentication プラグインを Capacitor アプリにどのようにインストールするか?

「bun add @capgo/capacitor-firebase-authentication」 (または「npm install @capgo/capacitor-firebase-authentication」) を実行し、次に「bunx cap sync」を実行して iOS と Android プロジェクトがネイティブ code を取得するようにします。次に、@capgo/capacitor-firebase-authentication をアプリの code でインポートします。

React、Vue、Angular と @capgo/capacitor-firebase-authentication はどのように動作する?

はい。Firebase Authentication は Capacitor パッケージなので、Ionic、React、Vue、Angular、Svelte、または単純な JavaScript など、Capacitor 内で実行される任意の Web フレームワークと互換性があります。

どの Capacitor バージョンが @capgo/capacitor-firebase-authentication に対応する?

Capgo plugins follow Capacitor's major version: use the plugin major version that matches your Capacitor major version (for example plugin v8 with Capacitor 8). The compatibility table in the GitHub README lists the maintained versions.

@capgo/capacitor-firebase-authentication は無料でオープンソースですか?

Yes. The source code is public on GitHub at https://github.com/Cap-go/capacitor-firebase/tree/main/packages/authentication and the package is free to install from npm. Bug reports and pull requests are welcome.

Firebase Authentication を使用する code を App Store のレビューなしで更新できますか?

codeを変更したりアップグレードしたりすると、ネイティブのcodeが更新されます。 その後、JavaScript、HTML、CSSの変更がプラグインを呼び出すと、Capgoライブアップデートで即時配信できます。

Firebase アUTHENTICATION の変更をアプリレビューの待たずに配信する

プラグインがストアビルドに追加されたら、Capgo ライブアップデートは、ユーザーに JavaScript、HTML、CSS の変更を数分でプッシュします。

Capgo で始めます