내용으로 건너뛰기

Firebase Google 로그인 (iOS)

GitHub

__CAPGO_KEEP_8__

__CAPGO_KEEP_9__

__CAPGO_KEEP_10__ __CAPGO_KEEP_11__.

  1. iOS 앱을 Firebase Console에 생성하기 전에 console.cloud.google.com

    Firebase 프로젝트 개요
  2. 버튼을 클릭하세요. Add app 버튼

    Firebase 앱 추가 버튼 Firebase Console에 앱 추가하기
  3. 선택 iOS

    Firebase Console에 iOS 앱 추가하기
  4. 폼의 첫 번째 부분을 완성하세요

    1. 폼을 Apple bundle ID
      1. Xcode에서 앱을 열어 npx cap open ios
      2. Xcode 프로젝트 탐색기에서 App Xcode 프로젝트 탐색기에서 앱을 선택한 경우에만
      3. Xcode의 Targets 섹션에 앱이 선택되어 있는지 확인하세요 Targets -> App Xcode의 Targets 섹션에 앱이 선택되어 있는지 확인하세요
      4. Find your Bundle Identifier Bundle Identifier field in Xcode project settings
      5. 복사하여 Bundle Identifier Firebase 콘솔에 붙여넣기 Firebase 앱 추가 iOS Bundle ID 필드
    2. 버튼을 클릭하세요 Register app Firebase 앱 추가 iOS 등록 버튼 Firebase Add App iOS Register Button
  5. Skip the Download config file step

    Firebase Add App iOS Skip Download Button
  6. Skip the Add firebase SDK step

    Firebase Add App iOS Skip Download Firebase SDK Button
  7. Skip the Add initialization code step

    Firebase Add App iOS Skip Add Initialization Code Button
  8. Click on the Continue to console button

    Firebase Add App iOS Continue to Console Button
  9. iOS 클라이언트 ID를 얻으세요. 그리고 YOUR_DOT_REVERSED_IOS_CLIENT_ID

    1. Google Cloud Console에 가세요. console.cloud.google.com

    2. 프로젝트를 찾으세요.

      1. 프로젝트 선택기 클릭하세요. Google Cloud Console 프로젝트 선택기
      2. Firebase 프로젝트의 정확한 이름으로 프로젝트를 검색하세요. 그리고 클릭하세요. 나의 경우는 sociallogin-tutorial-app. Firebase 프로젝트 선택기 프로젝트
    3. 검색 바를 열고 credentials

      1. 검색 바를 열고 Google Cloud Console 검색 바
      2. 검색하세요. credentials 그리고 클릭하세요. APIs and Services 스크린샷에서 2번에 해당하는 Google Cloud Console Credentials Search
    4. 클릭하세요. iOS client for [YOUR_APP_ID] (auto created by Google Service) 1입니다. 나의 경우는 sociallogin-tutorial-app.

      Google Cloud Console Credentials iOS Client ID
    5. 복사하세요. Client ID 그리고 iOS URL scheme. 이건 각각의 iOSClientIdYOUR_DOT_REVERSED_IOS_CLIENT_ID.

      __CAPGO_KEEP_10__ 버튼을 클릭하세요.
  10. __CAPGO_KEEP_11__ 로그인 방법 버튼을 클릭하세요.

    1. __CAPGO_KEEP_12__ 로그인 방법 버튼을 클릭하세요. Build -> Authentication __CAPGO_KEEP_13__ 로그인 방법 버튼을 클릭하세요.
    2. __CAPGO_KEEP_14__ 로그인 방법 버튼을 클릭하세요. Sign-in method __CAPGO_KEEP_15__ 로그인 방법 버튼을 클릭하세요. __CAPGO_KEEP_16__ 로그인 방법 버튼을 클릭하세요.
    3. Click on the Google 제공자 Google 제공자 Firebase 인증
    4. Click on the Web SDK configuration 버튼 Google 제공자 Firebase 인증 SDK 설정 버튼
    5. Copy the Web client ID. 이 설정은 플러그인의 webClientId 메서드입니다. initialize Google 제공자 Firebase 인증 __CAPGO_KEEP_0__ 설정 웹 클라이언트 ID Firebase Authentication Sign-in Method Web SDK Configuration Web Client ID
  11. Modify your app’s Info.plist

    1. Xcode를 열고 프로젝트 탐색기에서 Info.plist 파일

      Info.plist 파일을 찾으세요
    2. 이 파일을 오른쪽 클릭하고 소스 code로 열기

      오른쪽 클릭 메뉴에서 Open As Source Code 옵션
    3. 파일의 하단 부분에서 Plist 태그 </dict> Info.plist 파일의

      태그
    4. 닫는 태그 바로 앞에 다음 구문을 삽입하세요 </dict> URL schemes이 포함된 Info.plist __CAPGO_KEEP_0__를 닫는 태그 앞에 삽입하세요

      URL schemes이 포함된 Info.plist code를 닫는 태그 앞에 삽입하세요
      <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>
    5. 변경 YOUR_DOT_REVERSED_IOS_CLIENT_ID 9번 단계에서 복사한 iOS URL 스키마의 실제 역전된 클라이언트 ID를 삽입한 Info.plist

      주의
  12. 9번 단계에서 복사한 iOS 클라이언트 ID를 YOUR_IOS_CLIENT_ID 파일을 저장하세요.

  13. __CAPGO_KEEP_0__ Command + S

  14. Modify the AppDelegate.swift

    1. Open the AppDelegate

      AppDelegate.swift 파일을 Xcode 프로젝트 탐색기에서 열어보세요
    2. Insert import GoogleSignIn AppDelegate.swift 파일의 맨 위에

      AppDelegate.swift에 GoogleSignIn import를 추가하세요
    3. Find the func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) 기능

      AppDelegate의 원래 openURL 함수를 찾으세요
    4. Modify the function to look like this

      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 call
      var handled: Bool
      handled = GIDSignIn.sharedInstance.handle(url)
      if handled {
      return true
      }
      return ApplicationDelegateProxy.shared.application(app, open: url, options: options)
      }
      Modified application openURL function with GoogleSignIn handling
    5. __CAPGO_KEEP_0__ 파일을 저장하세요. Command + S

  15. __CAPGO_KEEP_0__ 앱에서 Google 로그인을 사용합니다.

    이 단계에서는 앱에서 Google 로그인을 사용할 준비가 되었습니다. Google 로그인을 사용하기 위해 예제 앱의 authUtils.ts 파일을 사용하여 Google과 인증하세요. Firebase Auth에서 사용자가 자동으로 생성됩니다.

__CAPGO_KEEP_0__

__CAPGO_KEEP_0__가 Firebase 웹 클라이언트 ID와 일치하는지 확인하세요.

  • Firebase Console에서 Google Sign-In이 활성화되어 있는지 확인하세요. idToken __CAPGO_KEEP_0__
  • __CAPGO_KEEP_0__
  • __CAPGO_KEEP_0__에 포함된 Info.plist가 올바른 URL schemes과 GIDClientID를 가지고 있는지 확인하세요.
  • Verify iOSServerClientId __CAPGO_KEEP_0__의 웹 클라이언트 ID와 일치하는지 확인하세요.
  • __CAPGO_KEEP_0__ 예제 앱을 참조하세요. example app code __CAPGO_KEEP_0__에서 Firebase Google Login on iOS로 계속 진행하세요.

Section titled “__CAPGO_KEEP_0__에서 Firebase Google Login on iOS로 계속 진행하세요.”

__CAPGO_KEEP_0__을 사용하여

Firebase Google Login on iOS 인증 및 계정 흐름을 계획하고 있습니다. __CAPGO_KEEP_0__을 __CAPGO_KEEP_1__-social-login과 연결하세요. Using @__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-social-login Using @capgo/capacitor-social-login native 기능을 사용하는 @capgo/capacitor-social-login을 위해 @capgo/capacitor-social-login native 기능 구현 세부사항을 위한 @capgo/capacitor-social-login @capgo/capacitor-passkey 구현 세부사항을 위한 @capgo/capacitor-passkey @capgo/capacitor-native-biometric 구현 세부사항을 위한 @capgo/capacitor-native-biometric, 그리고 두 단계 인증 구현 세부사항을 위한 두 단계 인증