Firebase Google 로그인 iOS
이 플러그인의 설치 단계와 전체 마크다운 가이드를 포함한 설정 프롬프트를 복사하세요.
이 문서는 iOS에서 Google Sign-In을 Firebase 인증과 통합하는 방법을 설명합니다. Firebase 인증을 사용하기 전에 Firebase 인증을 사용할 수 있도록 설정한 것으로 가정합니다. Firebase Google 설정.
설정 단계
설정 단계-
프로젝트 개요로 이동하세요. https://console.cloud.google.com
-
버튼
Add appFirebase 앱 추가 버튼
-
선택
iOS
-
폼의 첫 번째 부분을 채우세요
- 채우세요
Apple bundle ID- Xcode에서 앱을 열어보세요
npx cap open ios - Xcode 프로젝트 탐색기에서
App
- 앱 대상이 현재
Targets -> App
- 찾아보세요
Bundle Identifier
- 복사하여
Bundle IdentifierFirebase 콘솔에 붙여넣기
- Xcode에서 앱을 열어보세요
- 버튼 클릭
Register appbutton
- 채우세요
-
스키핑
Download config file단계
-
스키핑
Add firebase SDK단계
-
스키핑
Add initialization code단계
-
버튼을 클릭하세요
Continue to console__CAPGO_KEEP_0__
-
iOS 클라이언트 ID와
YOUR_DOT_REVERSED_IOS_CLIENT_ID-
Google Cloud Console로 이동하세요 console.cloud.google.com
-
프로젝트 찾기
- 프로젝트 선택기 클릭
- Firebase 프로젝트 정확한 이름으로 프로젝트를 검색하고 클릭하세요. 나의 경우는
sociallogin-tutorial-app.
- 프로젝트 선택기 클릭
-
검색바를 열고
credentials- 검색바 열기
- 검색
credentials및APIs and Services스크린샷의 2번
- 검색바 열기
-
클릭
iOS client for [YOUR_APP_ID] (auto created by Google Service)1. 나의 경우는sociallogin-tutorial-app.
-
클라이언트 ID
Client ID복사iOS URL schemeIDiOSClientId이것은 각각YOUR_DOT_REVERSED_IOS_CLIENT_ID.
-
-
웹 클라이언트 ID를 가져오세요.
- Firebase 콘솔로 돌아가서
Build->Authentication
- 버튼을 클릭하세요.
Sign-in method__CAPGO_KEEP_0__
- 클릭하여
Google서비스
- 클릭하여
Web SDK configuration버튼
- 복사하여
Web client ID이것은 플러그인에서 사용할webClientId구글 로그인initialize웹 __CAPGO_KEEP_0__ 설정
- Firebase 콘솔로 돌아가서
-
애플리케이션의 Info.plist을 수정하세요.
-
Xcode를 열고 프로젝트 탐색기에서
Info.plist파일
-
이 파일을 오른쪽 클릭하고 소스 code로 열기
-
파일의 하단 부분에서
Plist파일의 하단 부분에서</dict>태그
-
Info.plist 파일의 Closing dict 태그를 닫기 전에
</dict>닫기 태그
<key>CFBundleURLTypes</key><array><dict><key>CFBundleURLSchemes</key><array><string>YOUR_DOT_REVERSED_IOS_CLIENT_ID</string></array></dict></array><key>GIDClientID</key><string>YOUR_IOS_CLIENT_ID.apps.googleusercontent.com</string> -
변경
YOUR_DOT_REVERSED_IOS_CLIENT_ID9번 단계에서 복사한 iOS URL scheme의 값을 입력하세요
-
-
9번 단계에서 복사한 iOS Client ID를 입력하세요
YOUR_IOS_CLIENT_IDSTARTS -
파일을 저장하세요.
Command + S -
수정하세요.
AppDelegate.swift-
AppDelegate를 열어보세요.
-
삽입하세요.
import GoogleSignInAppDelegate.swift 파일의 맨 위에 GoogleSignIn import를 추가하세요.
-
함수
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:])AppDelegate의 원래 openURL 함수를 찾으세요.
-
클립보드에 복사하세요.
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {// Called when the app was launched with a url. Feel free to add additional processing here,// but if you want the App API to support tracking app url opens, make sure to keep this callvar handled: Boolhandled = GIDSignIn.sharedInstance.handle(url)if handled {return true}return ApplicationDelegateProxy.shared.application(app, open: url, options: options)}
-
파일을 저장하세요.
Command + S
-
-
앱에서 Google 로그인을 사용하는 방법
이 단계에서 앱에서 Google 로그인을 사용할 준비가 되었습니다. Google 로그인을 사용하기 위해 예제 앱의 authUtils.ts 파일을 사용하여 Google과 인증합니다. 사용자가 Firebase Auth에 처음 로그인할 때 자동으로 생성됩니다.
문제 해결
문제 해결
인증이 지연되거나 실패하는 경우:Firebase 웹 클라이언트 ID와 일치하는지 확인하세요.
- Firebase 웹 클라이언트 ID와 일치하는지 확인하세요.
idTokenaudience matches your Firebase web client ID - Google Sign-In이 Firebase Console에서 활성화되어 있는지 확인하세요.
- Info.plist에 올바른 URL schemes과 GIDClientID이 포함되어 있는지 확인하세요.
- 확인
iOSServerClientId웹 클라이언트 ID와 일치하는지 확인하세요. - 예시 앱 __CAPGO_KEEP_0__을 참조하세요. example app code Firebase Google Login on iOS에서 계속 진행하세요.
Firebase Google Login on iOS에서 계속 진행하는 방법
Firebase Google Login on iOS를 사용하여 인증 및 계정 흐름을 계획하고 있습니다.Firebase Google Login on iOS를 Firebase Google Login with Firebase에 연결하세요. Firebase Google Login with Firebase Firebase Google Login on iOS Using @capgo/capacitor-social-login for the native capability in Using @capgo/capacitor-social-login, @capgo/capacitor-social-login for the implementation detail in @capgo/capacitor-social-login, @capgo/capacitor-passkey for the implementation detail in @capgo/capacitor-passkey, @capgo/capacitor-native-biometric for the implementation detail in @capgo/capacitor-native-biometric, and 두 단계 인증 두 단계 인증의 구현 세부 정보를 위해