iOS에서 Firebase Google 로그인
설치 단계와 이 플러그인의 전체 마크다운 가이드를 포함한 설정 명령어를 복사하세요.
이 가이드는 iOS에서 Google Sign-In을 Firebase Authentication과 통합하는 데 도움이 될 것입니다. iOS에서 Google Sign-In을 Firebase Authentication과 통합하는 데 도움이 될 것입니다. __CAPGO_KEEP_0__ 설정.
설정 단계
설정 단계-
프로젝트 개요로 이동하세요. console.cloud.google.com
-
버튼
Add appFirebase 앱 추가 버튼
-
선택
iOS
-
폼의 첫 번째 부분을 채우세요
- 채우세요
Apple bundle ID- Xcode에서 앱을 열어보세요
npx cap open ios - Xcode 프로젝트 탐색기에서 앱 대상에 두 번 클릭하세요
App
- Ensure that you are on
Targets -> App
- Find your
Bundle Identifier
- 복사하고
Bundle IdentifierFirebase 콘솔에 붙여넣기
- Xcode에서 앱을 열어보세요
- 버튼을 클릭하세요.
Register app버튼을 클릭하세요.
- 채우세요
-
이 단계를 건너뛰세요.
Download config file단계를 건너뛰세요.
-
이 단계를 건너뛰세요.
Add firebase SDK단계를 건너뛰세요.
-
이 단계를 건너뛰세요.
Add initialization code단계를 건너뛰세요.
-
버튼을 클릭하세요.
Continue to console버튼을 클릭하세요.
-
Firebase 앱에 대한 iOS 클라이언트 ID와
YOUR_DOT_REVERSED_IOS_CLIENT_ID-
Google Cloud Console로 이동하세요. console.cloud.google.com
-
프로젝트 찾기
- 프로젝트 선택기
- 프로젝트 선택기
sociallogin-tutorial-app.
- 프로젝트 선택기
-
검색바를 열어
credentials- Google Cloud Console 검색바
- __CAPGO_KEEP_0__를 검색하고
credentials__CAPGO_KEEP_1__을 클릭하여APIs and Services스크린샷의 2번에 해당하는
- Google Cloud Console 검색바
-
__CAPGO_KEEP_2__을 클릭하여
iOS client for [YOUR_APP_ID] (auto created by Google Service)1입니다. 나의 경우는sociallogin-tutorial-app.
-
__CAPGO_KEEP_3__를
Client ID그리고 __CAPGO_KEEP_3__를iOS URL scheme이것은 각각 __CAPGO_KEEP_4__와 __CAPGO_KEEP_5__가 될 것입니다.iOSClientId__CAPGO_KEEP_5__는 __CAPGO_KEEP_4__의YOUR_DOT_REVERSED_IOS_CLIENT_ID.
-
-
__CAPGO_KEEP_11__
- __CAPGO_KEEP_12__ button
Build->Authentication
- __CAPGO_KEEP_14__ button
Sign-in method__CAPGO_KEEP_15__ button
- Click on the
Googleprovider
- Click on the
Web SDK configurationbutton
- Copy the
Web client ID. 이 설정은 플러그인의webClientIdmethod of the plugin.initializeFirebase Authentication Sign-in Method Web __CAPGO_KEEP_0__ Configuration Web Client ID
- __CAPGO_KEEP_12__ button
-
애플리케이션의 Info.plist 수정
-
Xcode를 열고 프로젝트 탐색기에서
Info.plist파일
-
이 파일을 오른쪽 클릭하고 소스 code로 열기
-
파일의 하단 부분에서
Plist파일에서</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 스키마로
-
-
변경
YOUR_IOS_CLIENT_IDiOS Client ID를 9번 단계에서 복사한 것과 동일하게 -
파일을 저장하세요.
Command + S -
수정하세요.
AppDelegate.swift-
AppDelegate를 열어보세요.
-
삽입하세요.
import GoogleSignIn파일의 맨 위에 추가하세요.
-
찾아보세요.
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:])함수
-
함수를 다음과 같이 수정하세요.
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)}
-
__CAPGO_KEEP_0__으로 파일을 저장하세요.
Command + S
-
-
앱에서 Google 로그인을 사용하는 방법
이 단계에서는 Google 로그인을 앱에서 사용할 준비가 되었습니다. 다음과 같이 사용하세요. authUtils.ts 예제 앱의 인증 파일을 사용하여 Google과 인증하세요.
사용자가 Firebase Auth에 처음 로그인할 때 자동으로 계정이 생성됩니다.
문제 해결
제목이 “문제 해결”인 섹션인증이 걸리거나 실패하는 경우:
- Firebase 웹 클라이언트 ID와 일치하는지 확인하세요.
idToken__CAPGO_KEEP_0__ - Google Sign-In이 Firebase Console에서 활성화되어 있는지 확인하세요.
- Info.plist에 올바른 URL schemes과 GIDClientID가 포함되어 있는지 확인하세요.
- Verify
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 on iOS와 연결하세요. 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 Two-factor authentication for the implementation detail in Two-factor authentication.