개발/파이어베이스

[Firebase] 2. Firebase Authentication 시작하기 (+구글로그인)

도넛의용기 2023. 1. 17. 10:17

https://bravenessofdonut.tistory.com/2

 

[Firebase] 1. Firebase 시작 (SDK설치)

파이어베이스 SDK설치를 중점으로 정리해보았습니다. 1. 프로젝트 만들기 2. Android앱에 Firebase 추가 gradlew signingReport을 안드로이드 스튜디오의 터미널에서 이용하면(Ctrl+Enter이용) SHA-1 구할 수 있

bravenessofdonut.tistory.com

위의 내용을 이미 했다는 가정 하에 작성하였습니다.

 

1. 좌측의 빌드에서 Authentication 선택

좌측 배너

2. Sign-in method로 들어가기

sign-in method

3. 이메일/비밀번호, Google (필요한거 선택하세요) 선택하고 사용설정 선택

설정 완료

4. build.gradle

1) 일반 로그인 기능 (자체 앱)

밑의 링크는 파이어베이스 공식문서입니다.

 

https://firebase.google.com/docs/auth/android/start?hl=ko&authuser=0#kotlin+ktx 

 

Android에서 Firebase 인증 시작하기

Firebase Summit에서 발표된 모든 내용을 살펴보고 Firebase로 앱을 빠르게 개발하고 안심하고 앱을 실행하는 방법을 알아보세요. 자세히 알아보기 이 페이지는 Cloud Translation API를 통해 번역되었습니

firebase.google.com

dependencies {
    // Import the BoM for the Firebase platform
    implementation platform('com.google.firebase:firebase-bom:31.1.1')

    // Add the dependency for the Firebase Authentication library
    // When using the BoM, you don't specify versions in Firebase library dependencies
    implementation 'com.google.firebase:firebase-auth-ktx'
}

위의 코드를 앱수준 build.gradle에 넣어주시면 되는데 파이어베이스 봄이 이미 추가되어있다면 밑의 코드만 넣어주시면 됩니다.

 

2) 구글 로그인

 

밑의 링크 역시 공식문서입니다.

 

https://firebase.google.com/docs/auth/android/google-signin?hl=ko 

 

Android에서 Google로 인증,Android에서 Google로 인증  |  Firebase 인증

Firebase Summit에서 발표된 모든 내용을 살펴보고 Firebase로 앱을 빠르게 개발하고 안심하고 앱을 실행하는 방법을 알아보세요. 자세히 알아보기 이 페이지는 Cloud Translation API를 통해 번역되었습니

firebase.google.com

dependencies {
    // Import the BoM for the Firebase platform
    implementation platform('com.google.firebase:firebase-bom:31.1.1')

    // Add the dependency for the Firebase Authentication library
    // When using the BoM, you don't specify versions in Firebase library dependencies
    implementation 'com.google.firebase:firebase-auth-ktx'

    // Also add the dependency for the Google Play services library and specify its version
    implementation 'com.google.android.gms:play-services-auth:20.4.0'
}

일반로그인 기능(4번의 1번) 의 코드를 추가하셨다면 맨 밑의 코드만 추가하시면 됩니다.

'개발 > 파이어베이스' 카테고리의 다른 글

[Firebase] 1. Firebase 시작 (SDK설치)  (0) 2023.01.16