페이스북 연동

Prev Next

Classic/VPC 환경에서 이용 가능합니다.

페이스북 로그인 기능을 사용하기 위한 콘솔 사용 가이드입니다.

게임팟 연동 이외 콘솔 사용법은 다음을 참조해 주십시오.

GAMEPOT 대시보드에 Facebook 로그인 인증 정보 등록

Facebook 인증 키를 대시보드에 등록하는 방법은 다음과 같습니다.

GAMEPOT 대시보드 > 프로젝트 설정 > 인증 > Facebook 메뉴를 차례대로 클릭해 주십시오.
gamepot-facebook0.png

Facebook 로그인 설정

Facebook 로그인을 사용하려면 GAMEPOT 대시보드 > 프로젝트 설정 > 인증 > Facebook 에서 총 3가지 항목에 대해 입력해 주십시오.
gamepot-facebook11.png

  1. Facebook App ID
  2. Facebook Protocol Scheme
  3. Facebook Client Token

앱 생성 시 주의 사항

  1. 이용 사례 > 앱에 필요한 기능 > 'Facebook 로그인을 통한 인증 및 사용자의 데이터 요청' 선택 후 앱 생성
    console_facebook03

  2. 앱 생성 완료 후, 'Facebook 로그인 버튼 추가 맞춤 설정 선택 > 권한 > email '추가'
    console_facebook04

    console_facebook05

Facebook Login 설정 값 확인

  1. 앱 만들기 > 앱 설정 > 기본 설정 >앱 ID를 게임팟 대시보드 'Facebook App ID ' 에 입력해 주십시오.
    gamepot-facebook04.png

  2. 'Facebook App ID '에 입력한 내용 앞에 'fb' 를 붙여 'Facebook Protocol Scheme' 에 입력해 주십시오.
    gamepot-facebook02.png

  3. 앱 설정 > 고급 설정 >클라이언트 토큰 내용을 'Facebook Client Token' 에 입력해 주십시오.
    gamepot-facebook03.png

  4. 앱 설정 > 기본 설정 >플랫폼 추가를 클릭한 후 플랫폼 을 선택해 주십시오.
    gamepot-facebook06.png

  5. Android 정보를 입력해 주십시오.
    gamepot-facebook08.png

    • 키 해시 : 사용 중인 키 해시 값 입력
    • 패키지이름 : Package name 입력
    • 클래스 이름: Package name 뒤에 .MainActivity 추가 입력
  6. iOS 플랫폼을 추가한 뒤 정보를 입력해 주십시오.

    • 번들 ID: App Store Connect와 동일한 번들 ID 입력
      console_facebook06

유니티의 경우 URL Schemes 입력 (iOS)

유니티의 경우 ios에서 페이스북 연동을 하려면 아래 방법과 같이 Schemes 값을 Supported URL Schemes에 입력해야 합니다.

[V3 페이스북 로그인을 위한 iOS URL Schemes 획득 위치]
페이스북 URL Schemes에 들어가야 할 내용은 다음 방법으로 확인해 주십시오

  • 페이스북 콘솔 > 앱 설정 > 기본 설정에서 확인된 APP IDfb를 붙인 값
    <예시> APP ID : 1822222222222222 일 경우 URL Schemes는 fb1822222222222222
    gamepot-facebook12.png

Player Settings -> Other Settings -> Supported URL Schemes 에 페이스북에서 발급된 iOS URL Schemes 를 그림과 같이 입력해 주십시오.

  • size에 '1'을 입력하면 Element 0 칸이 생겨 입력할 수 있습니다.
    gamepot-facebook13.png

AppDelegate.swift 메서드의 코드 대체 (iOS Native)

다음 코드를 사용하여 AppDelegate.swift 메서드의 코드를 대체합니다. 이 코드는 앱이 시작될 때 SDK를 초기화하며, 로그인이나 공유 작업을 수행할 때 SDK가 Facebook 네이티브 앱의 로그인과 공유를 처리하도록 합니다.

// AppDelegate.swift

class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate {
    
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
       
        
        ApplicationDelegate.shared.application(
            application,
            didFinishLaunchingWithOptions: launchOptions
        )
    }
    
    func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
        let sceneConfiguration = UISceneConfiguration(name: nil, sessionRole: connectingSceneSession.role)
        
        sceneConfiguration.delegateClass = SceneDelegate.self
        
        return sceneConfiguration
    }

    func application(_ application: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
        ...
        // 페이스북 로그인 콜백
        NotificationCenter.default.post(name: Notification.Name("FacebookLoginURL"), object: nil, userInfo: ["application": application, "url": url, "options": options, "type": "AppDelegate"])
        ...
        return true
    }
}

class SceneDelegate: UIResponder, UIWindowSceneDelegate {
    
    func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
        guard let url = URLContexts.first?.url else {
            return
        }

        ...
        // 페이스북 로그인 콜백
        NotificationCenter.default.post(name: Notification.Name("FacebookLoginURL"), object: nil, userInfo: ["url": url, "type": "SceneDelegate"])
        ...
    }