[英]How to use firebase login with email and password on Android
When I tried to follow the Firebase website for tutorial ( https://www.firebase.com/docs/web/guide/login/password.html ) on developing a simple login on android studio, I faced error, with red wiggly lines.当我尝试按照 Firebase 网站的教程 ( https://www.firebase.com/docs/web/guide/login/password.html ) 在 android studio 上开发一个简单的登录时,我遇到了错误,带有红色的摆动线.
Could someone help me or suggest a good place to learn about step by step tutorial on how to create a simple login using firebase.有人可以帮助我或建议一个好地方来学习有关如何使用 firebase 创建简单登录的分步教程。 Resources on firebase login for android are very limited online.用于 android 的 firebase 登录的资源在线非常有限。 Would be great if someone could help me .如果有人可以帮助我,那就太好了。
This is the code copied from firebase website for login, when I paste it into my code I have red error on email password function error UserData etc etc.这是从 firebase 网站复制的用于登录的代码,当我将其粘贴到我的代码中时,电子邮件密码功能错误 UserData 等出现红色错误。
mRef.createUser({
email : "bobtony@firebase.com",
password : "correcthorsebatterystaple"
}, function(error, userData) {
if (error) {
console.log("Error creating user:", error);
} else {
console.log("Successfully created user account with uid:", userData.uid);
}
});
ref.createUser("bobtony@firebase.com", "correcthorsebatterystaple", new Firebase.ValueResultHandler<Map<String, Object>>() { @Override public void onSuccess(Map<String, Object> result) { System.out.println("Successfully created user account with uid: " + result.get("uid")); } @Override public void onError(FirebaseError firebaseError) { // there was an error }
很抱歉它在一条线上,我目前正在使用电话并且它不能很好地处理代码我从https://www.firebase.com/docs/android/guide/login/password.html获得了代码
As mentioned above Firebase has a library https://github.com/firebase/FirebaseUI-Android that has useful tools including login.如上所述,Firebase 有一个库https://github.com/firebase/FirebaseUI-Android ,其中包含有用的工具,包括登录。 Sounds like you went through the code lab posted by Frank van Puffelen.听起来你经历了 Frank van Puffelen 发布的代码实验室。
If it is helpful, I have been working on a project that uses their library but adds additional functionality like new user registration, saving user data (like the new users name) into your Firebase database, etc and with, hopefully, easy implementation.如果有帮助,我一直在开发一个项目,该项目使用他们的库,但添加了额外的功能,如新用户注册、将用户数据(如新用户名)保存到您的 Firebase 数据库等,并且希望能够轻松实现。 I have step by step instructions on how to add my code to your project with my base example the code added to a blank Android project.我有关于如何使用我的基本示例将我的代码添加到您的项目的分步说明,该代码添加到一个空白的 Android 项目。
The project includes Google Auth as well.该项目还包括 Google Auth。 https://github.com/cardenuto/FirebaseLogin https://github.com/cardenuto/FirebaseLogin
to login using firebase with username and password使用带有用户名和密码的 firebase 登录
auth.signInWithEmailAndPassword(
edt_username.text.toString().trim(),
edt_password.text.toString().trim()
)
.addOnCompleteListener(this) { task ->
if (task.isSuccessful) {
// Sign in success, update UI with the signed-in user's information
Log.d("Status", "signInWithEmail:success")
val user = auth.currentUser
showAlert("User Logged-in Successfully ","Welcome :"+user)
} else {
// If sign in fails, display a message to the user.
Log.w("Status", "signInWithEmail:failure", task.exception)
showAlert("User not found ","Register")
}
}
http://www.androidcoding.in/2020/06/02/android-firebase-login-tutorial/ http://www.androidcoding.in/2020/06/02/android-firebase-login-tutorial/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.