[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)
  • 블로그 메뉴

    • 방명록
  • 링크

  • 공지사항

  • 인기 글

  • 태그

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

  • 최근 글

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

티스토리툴바