inflearn logo
강의

Course

Instructor

[Beginner Level] Learn Android Kotlin by Building 8 Apps

Firebase Email Login

09:55 질문입니다!

262

D Y

3 asked

0

-package com.daeyeon.fb_firebase_email_password_auth

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import android.widget.Button
import android.widget.EditText
import android.widget.Toast
import com.google.firebase.auth.FirebaseAuth
import com.google.firebase.auth.ktx.auth
import com.google.firebase.ktx.Firebase

class MainActivity : AppCompatActivity() {

private lateinit var auth: FirebaseAuth

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)

auth = Firebase.auth

val joinBtn = findViewById<Button>(R.id.joinBtn)
joinBtn.setOnClickListener {

val email = findViewById<EditText>(R.id.emailArea)
val password = findViewById<EditText>(R.id.passwordArea)

Log.d("MAIN", email.text.toString())
Log.d("MAIN", password.text.toString())


auth.createUserWithEmailAndPassword(email.text.toString(), password.text.toString())
.addOnCompleteListener(this) { task ->
if (task.isSuccessful) {
// Sign in success, update UI with the signed-in user's information
Toast.makeText(this, "성공", Toast.LENGTH_LONG).show()
} else {
// If sign in fails, display a message to the user.
Toast.makeText(this, "실패", Toast.LENGTH_LONG).show()

}
}

}
}
}
이메일 비번을 치고 회원가입을 누르면 자꾸 실패가 떠요!....

kotlin firebase android

Answer 2

1

zxcv78704257

엌ㅋㅋㅋㅋㅋ 저도 똑같은 문제였어요 감사합니다

0

bokchi

아래와 같이 else부분에 Log.d()를 이용해서 task.exception의 내용을 출력해보시겠어요?

이 부분을 실패 부분에 넣어보시면 됩니다.

Log.d(TAG, "createUserWithEmail:failure", task.exception)

 

나오는 로그메세지를 공유해주세요.

 

 

 

auth.createUserWithEmailAndPassword(email, password)
       
.addOnCompleteListener(this) { task ->
           
if (task.isSuccessful) {
               
// Sign in success, update UI with the signed-in user's information
               
Log.d(TAG, "createUserWithEmail:success")
               
val user = auth.currentUser
                updateUI
(user)
           
} else {
               
// If sign in fails, display a message to the user.
               
Log.w(TAG, "createUserWithEmail:failure", task.exception)
               
Toast.makeText(baseContext, "Authentication failed.",
                       
Toast.LENGTH_SHORT).show()
                updateUI
(null)
           
}
       
}

1

D Y

세상에 선생님.... 로그에 The given password is invalid. [ Password should be at least 6 characters ] 이렇게 떠서 6글자 로 해봤더니 성공이라 뜨네요 ㅜㅜㅜㅜ 감사합니다 ㅜㅜㅜ

주사위앱 소개 및 레이아웃 설정 문제

0

59

2

안드로이드 에뮬레이터가 실행이 안 되요...ㅠ

0

105

2

30 강 소스 좀 올려 주십시요

0

80

2

onBackPressed 함수가 동영상 하고 다르게 동작합니다.

0

89

2

ListView 초기 실행 안됩니다.

0

93

2

코딩을 완료하고난후 앱 실행시 자동 종료

0

71

2

datavinding에서 오류가 납니다.

0

51

1

안드로이드 스튜디오 버전 차이로 초기 empyt activity 선택하면 안됩니다.

0

106

2

context의 구별에 대하여

0

69

2

"프롤로그에서 ..." 오류 관련해 직전 질문에 대한 추가 질문입니다.

0

67

2

"프롤로그에서 콘텐츠가 허용되지 않습니다." 오류

0

154

3

해결완료

1

186

2

databinding 설정후 run하면 에러(해결)

0

222

2

databinding 설정 이후 실행시 에러

0

268

4

안드로이드 입문하는 사람입니다.

0

70

1

Firebase uid

0

75

3

activity_main 화면 다름

0

114

2

강의화면과 다른데 맞게진행되는것인가요...????

0

105

2

파이어베이스 질문

0

74

2

ActivityMainBinding에 오류가 납니다

0

133

2

선생님 onBackPressed 작동이 안되는거 같습니다

0

118

2

>app>res>layout 이 존재하지 않습니다.

0

119

2

안드로이드 스튜디오 미어캣 버전 사용 한글 깨짐

0

747

2

안드로이드 스튜디오 오류 발생 시 대처 방법은 요?

0

289

2