Firebase Authentication の開始方法
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
認証システムがすでに存在する場合
アプリにログイン機能がすでに実装されていて、それを使用して Firebase バックエンド サービスで認証を行う場合は、カスタム認証を使用します。これには、次のいずれかを使用するアプリが含まれます。
- パスワード ベースのカスタム システムなどの、カスタム開発されたソリューション。
- サードパーティの ID 管理サービス(Auth0、Okta など)。
- Google、Facebook、Apple などのフェデレーション ID プロバイダとの既存の統合(フェデレーション ID をまだサポートしていないものの、今後サポートする予定の場合は、次のセクションをご覧ください)。
カスタム認証では、任意のシステムを使用してユーザーのログインを処理し、バックエンドでそのユーザー用の Firebase トークンを作成します。クライアントからそのトークンが送付されるので、それを使用して Firebase で認証します。
iOS+、Android、ウェブ、Flutter、Unity、C++ 用のドキュメントをご覧ください。
Firebase を使用して認証システムを構築する場合
新しいアプリを作成する場合や、既存のアプリにログイン機能を追加する場合は、認証バックエンドを自分で構築しなくても安全な認証を実装できるライブラリとサービスが Firebase に用意されています。Firebase Authentication は、パスワード、フェデレーション ID プロバイダ、メールリンク、テキスト メッセージを使用したログインのための、完全なバックエンド ソリューションです。
簡単に使えるドロップイン ソリューションを利用したい場合
アプリに最も迅速かつ簡単に認証機能を追加するには、ドロップイン UI ライブラリの FirebaseUI Auth をご利用ください。FirebaseUI を使えば、Firebase Authentication でサポートされているすべてのログイン方法に対応可能な完全なユーザーフローを実装できます。
FirebaseUI Auth はドロップイン ソリューションであるため、UX がニーズに合わないという可能性があります。UX を変更する場合は、オープンソースのライブラリをフォークして独自のバージョンを使用できます。ただし、ログインフローが大きく異なる場合は、次のセクションで説明するように、Firebase SDK を使用して独自のフローを実装することをおすすめします。
iOS、Android、ウェブ用の FirebaseUI Auth ドキュメントをご覧ください。
ログイン エクスペリエンスを完全に制御したい場合
アプリのログイン エクスペリエンスを細かく制御するには、独自の認証フローを実装し、Firebase SDK を使用して Firebase の認証サービスを操作します。たとえば、独自のメールアドレスとパスワードのフロー、または Google ログインのフローを作成し、ユーザー認証用にユーザーのメールアドレスとパスワード、あるいは Google ID トークンを Firebase に渡します。
次の Firebase Authentication SDK のドキュメントをご覧ください。
ログイン前のリッチなエクスペリエンスを構築する場合
匿名認証を使用することによって、ユーザーが実際にログインする前に、アプリのログイン後の機能を使用させることができます。匿名の「ログイン」では、実際のアカウントと同じように使用できる、一時的なシングル セッション アカウントを作成します。ユーザーがログインまたは登録した後に、この一時的なアカウントを実際のアカウントにリンクすることによって、ユーザーは前回終了したところから操作を続行できます。
匿名認証は、カスタム認証や Firebase の認証サービスと適切に連動します。
iOS+、Android、ウェブ、Flutter、Unity、C++ 用のドキュメントをご覧ください。
バックエンドから Firebase サービスにアクセスする場合
サーバーから Firebase サービスにアクセスする場合、Firebase Authentication を使用する必要はありません。代わりに、Admin SDKを使用します。Admin SDK を初期化するときに、特定のユーザーではなく Firebase プロジェクトを表すサービス アカウント認証情報で認証します。これにより、プロジェクトのリソースへの完全アクセス権が付与されます。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-08-04 UTC。
[null,null,["最終更新日 2025-08-04 UTC。"],[],[],null,["I already have an authentication system\n\nIf your app already has a sign-in implementation and you want to use it to\nauthenticate with Firebase backend services, use **Custom Authentication**. This\nincludes apps that use any of the following:\n\n- Custom-built solutions, such as custom password-based systems.\n- Third-party identity management services, such as Auth0 or Okta.\n- Existing integrations with federated identity providers, such as Google, Facebook, or Apple. (And if you don't yet support federated identity, but you want to, see the next section.)\n\nWith custom authentication, you sign users in with the system of your choice,\ncreate a Firebase token for the user on your backend, and then use the token\nfrom the client to authenticate with Firebase.\n\nSee the docs for\n[iOS+](/docs/auth/ios/custom-auth),\n[Android](/docs/auth/android/custom-auth),\n[Web](/docs/auth/web/custom-auth),\n[Flutter](/docs/auth/flutter/custom-auth),\n[Unity](/docs/auth/unity/custom-auth), or\n[C++](/docs/auth/cpp/custom-auth).\n\nI want to build my authentication system with Firebase\n\nIf you're building a new app or adding sign-in to an existing app, Firebase has\nlibraries and services that can help you implement secure authentication without\nhaving to build the authentication backend yourself. Firebase Authentication is a\ncomplete backend solution for signing in with passwords, federated identity\nproviders, email links, and text messages.\n\nI want a drop-in solution that's easy to use\n\nThe fastest and easiest way to add authentication to an app is to use\n**FirebaseUI Auth** , a drop-in UI library. FirebaseUI implements complete user\nflows for all of Firebase Authentication's supported sign-in methods.\n\nBecause FirebaseUI Auth is a drop-in solution, it has a specific UX that might\nnot meet your needs. If you want to change the UX, you can fork the library,\nwhich is open source, and use your own version. However, for substantially\ndifferent sign-in flows, you might prefer to implement your own flows with the\nFirebase SDK as discussed in the next section.\n\nSee the FirebaseUI Auth docs for\n[iOS](/docs/auth/ios/firebaseui),\n[Android](/docs/auth/android/firebaseui), or\n[Web](/docs/auth/web/firebaseui).\n\nI want full control over the sign-in experience\n\nFor more control over your app's sign-in experience, you can implement your own\nauthentication flows and use the Firebase SDK to work with Firebase's\nauthentication services. For example, build your own email address and password\nflow or Google Sign-in flow, and pass the user's email address and password or\nGoogle ID token to Firebase to authenticate the user.\n\nSee the Firebase Authentication SDK docs:\n\n| Firebase services ||\n|----------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| **Email address and password sign-in** | [iOS+](/docs/auth/ios/password-auth) \\| [Android](/docs/auth/android/password-auth) \\| [Web](/docs/auth/web/password-auth) \\| [Flutter](/docs/auth/flutter/password-auth) \\| [Unity](/docs/auth/unity/password-auth) \\| [C++](/docs/auth/cpp/password-auth) |\n| **Phone number sign-in** | [iOS+](/docs/auth/ios/phone-auth) \\| [Android](/docs/auth/android/phone-auth) \\| [Web](/docs/auth/web/phone-auth) \\| [Flutter](/docs/auth/flutter/phone-auth) \\| [Unity](/docs/auth/unity/phone-auth) \\| [C++](/docs/auth/cpp/phone-auth) |\n| **Email link sign-in** | [iOS+](/docs/auth/ios/email-link-auth) \\| [Android](/docs/auth/android/email-link-auth) \\| [Web](/docs/auth/web/email-link-auth) \\| [Flutter](/docs/auth/flutter/email-link-auth) \\| [Unity](/docs/auth/unity/email-link-auth) \\| [C++](/docs/auth/cpp/email-link-auth) |\n| **Google** | [iOS+](/docs/auth/ios/google-signin) \\| [Android](/docs/auth/android/google-signin) \\| [Web](/docs/auth/web/google-signin) \\| [Flutter](/docs/auth/flutter/federated-auth#google) \\| [Unity](/docs/auth/unity/google-signin) \\| [C++](/docs/auth/cpp/google-signin) |\n| **Facebook** | [iOS+](/docs/auth/ios/facebook-login) \\| [Android](/docs/auth/android/facebook-login) \\| [Web](/docs/auth/web/facebook-login) \\| [Flutter](/docs/auth/flutter/federated-auth#facebook) \\| [Unity](/docs/auth/unity/facebook-login) \\| [C++](/docs/auth/cpp/facebook-login) |\n| **Apple** | [iOS+](/docs/auth/ios/apple) \\| [Android](/docs/auth/android/apple) \\| [Web](/docs/auth/web/apple) \\| [Flutter](/docs/auth/flutter/federated-auth#apple) \\| [Unity](/docs/auth/unity/apple) \\| [C++](/docs/auth/cpp/apple) |\n| **Play Games** | [Android](/docs/auth/android/play-games) \\| [Unity](/docs/auth/unity/play-games) \\| [C++](/docs/auth/cpp/play-games) |\n| **Game Center** | [iOS+](/docs/auth/ios/game-center) |\n| **GitHub** | [iOS+](/docs/auth/ios/github-auth) \\| [Android](/docs/auth/android/github-auth) \\| [Web](/docs/auth/web/github-auth) \\| [Flutter](/docs/auth/flutter/federated-auth#github) \\| [Unity](/docs/auth/unity/github-auth) \\| [C++](/docs/auth/cpp/github-auth) |\n| **Microsoft** | [iOS+](/docs/auth/ios/microsoft-oauth) \\| [Android](/docs/auth/android/microsoft-oauth) \\| [Web](/docs/auth/web/microsoft-oauth) \\| [Unity](/docs/auth/unity/microsoft-oauth) \\| [C++](/docs/auth/cpp/microsoft-oauth) |\n| **Twitter** | [iOS+](/docs/auth/ios/twitter-login) \\| [Android](/docs/auth/android/twitter-login) \\| [Web](/docs/auth/web/twitter-login) \\| [Flutter](/docs/auth/flutter/federated-auth#twitter) \\| [Unity](/docs/auth/unity/twitter-login) \\| [C++](/docs/auth/cpp/twitter-login) |\n| **Yahoo** | [iOS+](/docs/auth/ios/yahoo-oauth) \\| [Android](/docs/auth/android/yahoo-oauth) \\| [Web](/docs/auth/web/yahoo-oauth) \\| [Unity](/docs/auth/unity/yahoo-oauth) \\| [C++](/docs/auth/cpp/yahoo-oauth) |\n\nI want to build rich pre-sign-in experiences\n\nYou can enable users to use the signed-in features of your app before they\nactually sign in using **Anonymous Auth**. With anonymous \"sign-in\", you create\ntemporary single-session accounts, which you can use like a real account. Then,\nafter the user signs in or signs up, link the temporary account to the real\naccount to let them continue where they left off.\n\nAnonymous Auth works well alongside either Custom Auth or any of Firebase's\nauthentication services.\n\nSee the docs for\n[iOS+](/docs/auth/ios/anonymous-auth),\n[Android](/docs/auth/android/anonymous-auth),\n[Web](/docs/auth/web/anonymous-auth),\n[Flutter](/docs/auth/flutter/anonymous-auth),\n[Unity](/docs/auth/unity/anonymous-auth), or\n[C++](/docs/auth/cpp/anonymous-auth).\n\nI want to access Firebase services from my backend\n\nTo access Firebase services from a server, you don't need to use\nFirebase Authentication. Instead, use the [Admin SDK](/docs/admin/setup). When you\ninitialize the Admin SDK, you authenticate with service account credentials,\nwhich represent your Firebase project rather than a particular user, and which\ngrant full access to your project's resources."]]