비밀번호가 있는 신규 사용자 계정을 만들려면 createUserWithEmailAndPassword() 메서드를 호출합니다.
try{finalcredential=awaitFirebaseAuth.instance.createUserWithEmailAndPassword(email:emailAddress,password:password,);}onFirebaseAuthExceptioncatch(e){if(e.code=='weak-password'){print('The password provided is too weak.');}elseif(e.code=='email-already-in-use'){print('The account already exists for that email.');}}catch(e){print(e);}
일반적으로 앱의 로그인 화면에서 이 작업을 수행합니다. 신규 사용자가 앱의 가입 양식을 사용해 가입하고 나면 필요에 따라 앱에서 계정 유효성 검사 절차를 완료합니다. 검사 항목의 예시로는 신규 계정의 비밀번호를 정확하게 입력했는지, 비밀번호가 복잡성 조건을 충족하는지 등이 있습니다.
신규 계정이 생성되면 사용자도 로그인됩니다. 인증 상태의 변경사항을 수신 대기하면 새 이벤트가 리스너로 전송됩니다.
비밀번호로 사용자 로그인을 처리하는 절차는 신규 계정을 생성하는 절차와 비슷합니다. 앱의 로그인 화면에서 signInWithEmailAndPassword()를 호출합니다.
try{finalcredential=awaitFirebaseAuth.instance.signInWithEmailAndPassword(email:emailAddress,password:password);}onFirebaseAuthExceptioncatch(e){if(e.code=='user-not-found'){print('No user found for that email.');}elseif(e.code=='wrong-password'){print('Wrong password provided for that user.');}}
다음 단계
사용자가 새 계정을 만들면 이 계정이 Firebase 프로젝트의 일부로 저장되며, 사용자가 사용한 로그인 방법과 관계없이 프로젝트의 모든 앱에서 사용자 식별에 사용될 수 있습니다.
앱의 User 객체에서 사용자의 기본 프로필 정보를 가져올 수 있습니다. 사용자 관리를 참조하세요.
Firebase 실시간 데이터베이스와 Cloud Storage 보안 규칙의 auth 변수에서 로그인한 사용자의 고유 사용자 ID를 가져온 후 이 ID를 사용해 사용자가 액세스할 수 있는 데이터를 관리할 수 있습니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-04(UTC)"],[],[],null,["# Authenticate with Firebase using Password-Based Accounts on Flutter\n\n\u003cbr /\u003e\n\nYou can use Firebase Authentication to let your users authenticate with\nFirebase using email addresses and passwords.\n\nBefore you begin\n----------------\n\n1. If you haven't already, follow the steps in the [Get started](/docs/auth/flutter/start) guide.\n\n2. Enable Email/Password sign-in:\n\n - In the Firebase console's **Authentication** section, open the [Sign in method](https://console.firebase.google.com/project/_/authentication/providers) page.\n - From the **Sign in method** page, enable the **Email/password sign-in** method and click **Save**.\n\nCreate a password-based account\n-------------------------------\n\nTo create a new user account with a password, call the `createUserWithEmailAndPassword()`\nmethod: \n\n try {\n final credential = await FirebaseAuth.instance.createUserWithEmailAndPassword(\n email: emailAddress,\n password: password,\n );\n } on FirebaseAuthException catch (e) {\n if (e.code == 'weak-password') {\n print('The password provided is too weak.');\n } else if (e.code == 'email-already-in-use') {\n print('The account already exists for that email.');\n }\n } catch (e) {\n print(e);\n }\n\nTypically, you would do this from your app's sign-up screen. When a new user\nsigns up using your app's sign-up form, complete any new account validation\nsteps that your app requires, such as verifying that the new account's password\nwas correctly typed and meets your complexity requirements.\n\nIf the new account was created successfully, the user is also signed in. If you\nare listening to changes in [authentication state](/docs/auth/flutter/start#auth-state), a new\nevent will be sent to your listeners.\n\nAs a follow-up to creating a new account, you can\n[Verify the user's email address](/docs/auth/flutter/manage-users#verify-email).\n| **Note:** To protect your project from abuse, Firebase limits the number of new email/password and anonymous sign-ups that your application can have from the same IP address in a short period of time. You can request and schedule temporary changes to this quota from the [Firebase console](https://console.firebase.google.com/project/_/authentication/providers).\n\nSign in a user with an email address and password\n-------------------------------------------------\n\nThe steps for signing in a user with a password are similar to the steps for\ncreating a new account. From your your app's sign-in screen, call\n`signInWithEmailAndPassword()`: \n\n try {\n final credential = await FirebaseAuth.instance.signInWithEmailAndPassword(\n email: emailAddress,\n password: password\n );\n } on FirebaseAuthException catch (e) {\n if (e.code == 'user-not-found') {\n print('No user found for that email.');\n } else if (e.code == 'wrong-password') {\n print('Wrong password provided for that user.');\n }\n }\n\n| **Caution:** When a user uninstalls your app on iOS or macOS, the user's authentication state can persist between app re-installs, as the Firebase iOS SDK persists authentication state to the system keychain. See issue [#4661](https://github.com/firebase/flutterfire/issues/4661) for more information.\n\nNext steps\n----------\n\nAfter a user creates a new account, this account is stored as part of your\nFirebase project, and can be used to identify a user across every app in your\nproject, regardless of what sign-in method the user used.\n\nIn your apps, you can get the user's basic profile information from the\n`User` object. See [Manage Users](/docs/auth/flutter/manage-users).\n\nIn your Firebase Realtime Database and Cloud Storage Security Rules, you can\nget the signed-in user's unique user ID from the `auth` variable, and use it to\ncontrol what data a user can access.\n\nYou can allow users to sign in to your app using multiple authentication\nproviders by [linking auth provider credentials](/docs/auth/flutter/account-linking)) to an\nexisting user account.\n\nTo sign out a user, call `signOut()`: \n\n await FirebaseAuth.instance.signOut();"]]