[Android Studio] Google 로그인 인증(2)

2019. 8. 18. 10:56·App/Android

[Android Studio] Google 로그인 인증(1)에 에서 Android Studio에 Firebase 기능을 추가했다면 이제 본격적으로 인증 기능을 넣을 것이다.

 

https://firebase.google.com/docs/auth/android/google-signin?authuser=0

 

Android에서 Google 로그인을 사용하여 인증하기  |  Firebase

앱에 Google 로그인을 통합하여 사용자가 Google 계정을 통해 Firebase에 인증하도록 할 수 있습니다. 시작하기 전에 아직 추가하지 않았다면 Android 프로젝트에 Firebase를 추가합니다. 프로젝트 수준 build.gradle 파일의 buildscript 및 allprojects 섹션에 Google의 Maven 저장소가 포함되어야 합니다. 다음과 같이 모듈(앱 수준) Gradle 파일(일반적으로 app/build.gradle)에 Fir

firebase.google.com

 


 

다음과 같이 모듈(앱 수준) Gradle 파일(일반적으로 app/build.gradle)에 Firebase 인증 Android 라이브러리 및 Google Play 서비스 종속 항목을 추가합니다.

 

입력 한 후 반드시 Sync Now누르기!

implementation 'com.google.firebase:firebase-auth:18.0.0'
implementation 'com.google.android.gms:play-services-auth:17.0.0'

 

그 다음 Firebase 콘솔로 이동해 Authentication에 들어간 다음 로그인 방법 탭에서 Google 로그인 방법을 사용 설정하고 저장을 클릭합니다.

 

로그인 방법 설정 누르기!

 

 

사용 설정됨으로 해줘야한다.

 

 


 

이렇게 모두 설정이 됐다면 Android Studio의 xml에 Sign in button을 만들어 준다.

 

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <com.google.android.gms.common.SignInButton
        android:id="@+id/signin_btn"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
    </com.google.android.gms.common.SignInButton>
    
</RelativeLayout>

 

이렇게 SingInButton을 만들어 주고 preview를 확인해보면
짜잔! 이렇게 Google 인증 버튼이 만들어져 있다!

 

 

2019/08/18 - [Android ] - [Android Studio] Google 로그인 인증 (3)

 

[Android Studio] Google 로그인 인증 (3)

https://firebase.google.com/docs/auth/android/google-signin?authuser=0 Android에서 Google 로그인을 사용하여 인증하기 | Firebase 앱에 Google 로그인을 통합하여 사용자가 Google 계정을 통해 Firebase에..

sy-blog.tistory.com

'App > Android' 카테고리의 다른 글

Fragment를 화면에 추가하는 방법 이해하기  (0) 2019.09.24
[Android] RecyclerView  (0) 2019.08.27
[Android] SharedPreference  (0) 2019.08.27
[Android Studio] Google 로그인 인증 (3)  (0) 2019.08.18
[Android Studio] Google 로그인 인증(1)  (0) 2019.08.18
'App/Android' 카테고리의 다른 글
  • [Android] RecyclerView
  • [Android] SharedPreference
  • [Android Studio] Google 로그인 인증 (3)
  • [Android Studio] Google 로그인 인증(1)
soyeon26
soyeon26
  • soyeon26
    개발 일지
    soyeon26
  • 전체
    오늘
    어제
    • 분류 전체보기 (107)
      • Web (22)
        • Web (1)
        • HTTP (0)
      • Language (29)
        • Java Script (3)
        • Type Srcipt (1)
        • Java (25)
      • Front (19)
        • HTML+CSS (4)
        • React (15)
      • Back (41)
        • Spring(Springboot) (9)
        • JSP (21)
        • Database (5)
        • NestJS (6)
      • Devops (6)
        • Docker (1)
        • Git & SVN (5)
      • App (7)
        • Android (7)
      • IT 정보 (3)
  • 블로그 메뉴

    • 방명록
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    SSR
    과학기술인 등록번호 발급
    백엔드
    인프런
    javascript
    Spring
    React Next.js
    과학기술인 번호 발급
    과학기술인번호 조회
    Next.js 필요성
    과학기술인등록번호 조회
    자바스크립트set
    과학기술인 등록
    데이터베이스 강의
    김영한
    프론트엔드
    Next.js
    SQL강의 추천
    java의 정석
    springboot
    서블릿
    강의후기
    Java
    csrvsssr
    csr과ssr의 차이
    스프링부트
    React
    중복제거
    sql강의
    강의 후기
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.0
soyeon26
[Android Studio] Google 로그인 인증(2)

개인정보

  • 티스토리 홈
  • 포럼
  • 로그인
상단으로

티스토리툴바

단축키

내 블로그

내 블로그 - 관리자 홈 전환
Q
Q
새 글 쓰기
W
W

블로그 게시글

글 수정 (권한 있는 경우)
E
E
댓글 영역으로 이동
C
C

모든 영역

이 페이지의 URL 복사
S
S
맨 위로 이동
T
T
티스토리 홈 이동
H
H
단축키 안내
Shift + /
⇧ + /

* 단축키는 한글/영문 대소문자로 이용 가능하며, 티스토리 기본 도메인에서만 동작합니다.