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

Firebase Authentication Capacitor プラグイン

Capacitor プラグイン for 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

ガイド

CapacitorでFirebase Authenticationを使用する方法

@capgo/capacitor-firebase-authentication

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 アプリがウェブサインインフローを開始した場合、OSがアプリをバックグラウンドでクリーンアップした場合に返されます。
getIdToken 現在サインインしているユーザーのFirebase Auth IDトークンを取得します。
getIdTokenResult Firebaseサービスにユーザーを識別するために使用されるデシリアライズされたJSON Webトークンを返します。
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 ゲームセンターサインインフローを開始します。
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()

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

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 のコアメソッドがリストされています。リスナーとバージョンヘルパー、各メソッドのフルコントラクトは、以下のリポジトリに記載されています。 GitHub リポジトリ.

イベントをリスンする

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

__CAPGO_KEEP_0__ リファレンス

@capgo/capacitor-firebase-authentication

あなたが使用している場合 capgo/capacitor-firebase-authenticationを使用 認証とアカウントフローの計画を行うには、__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-firebase-authenticationと接続 capgo/capacitor-social-loginと接続 capgo/capacitor-social-loginの実装詳細 capgo/capacitor-passkeyの実装詳細 capgo/capacitor-native-biometricの実装詳細 @capgo/capacitor-native-biometric for the implementation detail in @capgo/capacitor-native-biometric, SSO (Enterprise) SSO (Enterprise)の実装詳細 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 はどのように動作しますか?

Yes. Firebase Authentication is a Capacitor package, so it works with any web framework that runs inside Capacitor, including Ionic, React, Vue, Angular, Svelte and plain JavaScript.

どの 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 Authenticationの変更を配信します

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

Capgo で始めます