Facebook integration

Prev Next

Available in Classic and VPC

This is a console user guide for using the Facebook login feature.

For instructions on using the console other than integrating with GAMEPOT, see the following.

Register Facebook login authentication information on GAMEPOT dashboard

The following describes how to register a Facebook authentication key to the dashboard.

Click the GAMEPOT dashboard > Project settings > Authentication > Facebook menus, in that order.
gamepot-facebook0.png

Set Facebook login

To use Facebook login, enter the following three items in the GAMEPOT dashboard > Project settings > Authentication > Facebook.
gamepot-facebook11.png

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

Precautions when creating app

  1. Select Use Cases > Features needed for the app > "Authenticate and request data from users with Facebook Login," and then create the app.
    console_facebook03

  2. After app creation is completed, select Customize Facebook login button, and then add "email" under Permissions.
    console_facebook04

    console_facebook05

Check Facebook login settings

  1. Enter Create App > App Settings > Basic Settings>App ID into Facebook app ID of the GAMEPOT dashboard.
    gamepot-facebook04.png

  2. Attach "fb" in front of the "Facebook app ID" and enter it in Facebook protocol scheme.
    gamepot-facebook02.png

  3. Enter the content of the client token in App Settings > Advanced settings in Facebook client token.
    gamepot-facebook03.png

  4. Click App Settings > Basic Settings>Add Platform, and then select Platform.
    gamepot-facebook06.png

  5. Enter the Android information.
    gamepot-facebook08.png

    • Key hash: Enter the key has value in use.
    • Package name: Enter the package name.
    • Class name: Enter by attaching .MainActivity at the end of the package name.
  6. Add the iOS platform, and then enter the information.

    • Bundle ID: Enter the same bundle ID from App Store Connect.
      console_facebook06

Enter URL schemes for Unity (iOS)

In the case of Unity, to integrate Facebook on iOS, enter the Schemes value in Supported URL Schemes as shown below.

[Location of iOS URL Schemes for Facebook login v3]
The content to be entered into Facebook URL Schemes can be checked using the following method.

  • The value of App ID checked from Facebook console > App Settings > Basic Settings with fb appended to it.
    <Example> If the app ID is 1822222222222222, URL Schemes is fb1822222222222222.
    gamepot-facebook12.png

Enter the iOS URL scheme issued by Facebook in Player Settings -> Other Settings -> Supported URL Schemes as shown in the picture.

  • If you enter "1" for size, an Element 0 field appears and you can enter it.
    gamepot-facebook13.png

Replace code in AppDelegate.swift method (iOS native)

Replace the code in the AppDelegate.swift method using the following code. This code initializes the SDK when the app starts and allows the SDK to handle Facebook native app login and sharing when performing login or sharing tasks.

// 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 {
        ...
        // Facebook login callback
        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
        }

        ...
        // Facebook login callback
        NotificationCenter.default.post(name: Notification.Name("FacebookLoginURL"), object: nil, userInfo: ["url": url, "type": "SceneDelegate"])
        ...
    }