Skip to content

iOS

This page guides the Hive SDK iOS authentication configuration.

Adding features

Add the authentication feature frameworks to the Podfile in your project directory. Only add the authentication features you want to use.

To use the Device Management Service, add the following framework:

pod 'HiveDeviceManagement', $HIVE_SDK_VERSION # Framework for managing the devices of app users

To use Google Recaptcha for guest login, add the following framework:

pod 'HiveGoogleRecaptcha', $HIVE_SDK_VERSION # Framework for using the Google recaptcha enterprise feature based on bot scores during guest login

Based on regulations such as the [Notice on the Further Strict Management of Online Game Addiction of Minors] announced by the National Press and Publication Administration of China, to use the feature that requires real-name verification for users accessing from China only for games that have obtained Chinese game licenses, add the following framework:

pod 'HiveRealNameVerification', $HIVE_SDK_VERSION # Real-name verification service added


After saving the Podfile with the frameworks you want to use, run the following command to install the frameworks in your project:

pod install

Adding IdP

Add the IdP frameworks to the Podfile in your project directory. Only add the IdPs you want to use.


Below is an example of adding frameworks to use in the Podfile in your project directory. The guest login feature can be used without adding a framework.

pod 'HiveAuthV4ProviderAppleSignIn', $HIVE_SDK_VERSION # Signin with Apple login
pod 'HiveAuthV4ProviderFacebook', $HIVE_SDK_VERSION # Facebook idp, social Facebook feature
pod 'HiveAuthV4ProviderQQ', $HIVE_SDK_VERSION # QQ IdP
pod 'HiveAuthV4ProviderVK', $HIVE_SDK_VERSION # VK IdP
pod 'HiveAuthV4ProviderWechat', $HIVE_SDK_VERSION # WeChat IdP
pod 'HiveAuthV4ProviderGoogle', $HIVE_SDK_VERSION # Google IdP
pod 'HiveAuthV4ProviderAppleGameCenter', $HIVE_SDK_VERSION # Apple game center IdP
pod 'HiveAuthV4ProviderHive', $HIVE_SDK_VERSION # Membership login, Hive SDK Social feature
pod 'HiveAuthV4ProviderWeverse', $HIVE_SDK_VERSION # Weverse IdP

When using Line IdP, if the target is below iOS 13, only add the following framework:

pod 'HiveAuthV4ProviderLine', $HIVE_SDK_VERSION # Line IdP

If it is iOS 13 or above, add the following frameworks:

pod 'HiveAuthV4ProviderLine', $HIVE_SDK_VERSION # Line IdP
pod 'HiveAuthV4ProviderLine/LineSDKSwift11', $HIVE_SDK_VERSION # Line idp(5.11.0 / iOS 13 or above)

After saving the Podfile with the frameworks you want to use, run the following command to install the frameworks in your project:

pod install

Additional setup by IdP

Additional setup is required depending on the IdP.

Signin with Apple IdP setup

Here are the instructions for setting up the Signin With Apple IdP. Follow these steps to add Apple login to your IdP list.

  1. Select your project from the project navigator in the Xcode project window.
  2. Select your app from the TARGETS list.
  3. Click the Signing & Capabilities tab.
  4. Click the + Capability button at the top left of the Signing & Capabilities tab.
  5. Select Sign In with Apple from the list to add it.

  6. You can see the added Sign In with Apple in the Signing & Capabilities list.

    ]

Apple game center IdP setup

Here are the instructions for setting up the Apple Game Center IdP. Follow these steps to add Apple Game Center login to your IdP list.

  1. Select your project from the project navigator in the Xcode project window.
  2. Select your app from the TARGETS list.
  3. Click the Signing & Capabilities tab.
  4. Click the + Capability button at the top left of the Signing & Capabilities tab.
  5. Select GameCenter from the list to add it.

  6. You can see the added Game Center in the Signing & Capabilities list.

Facebook IdP setup

Here are the instructions for setting up the Facebook IdP.

Entering Facebook AppID and ClientToken

Follow the instructions below to enter the Facebook AppID and ClientToken in your Xcode project.

  1. Select your project from the project navigator in the Xcode project window.
  2. Select your app from the TARGETS list.
  3. Click the Info tab.
  4. Click the Custom iOS Target Properties item in the Info tab and enter your Facebook App ID in the FacebookAppID property.

    5. Check the FacebookClientToken in the Facebook console App Dashboard by going to Settings > Advanced > Security > Client Token. 6. Click the Custom iOS Target Properties item in the Info tab and enter the FacebookClientToken in the FacebookClientToken property. 7. Click the URL Types item in the Info tab, then click the + icon to create an Additional url type properties item. 8. Enter the Facebook AppID with fb appended (example: fb012342478841523) in the URL Schemes field of the Additional url type properties item.

Adding Facebook scheme to whitelist

To add the Facebook Scheme to the whitelist, you can either use the project window or add the code directly to the Info.plist file.

Note

Starting with iOS 9, switching to external apps is only allowed for Schemes added to the whitelist. In the iOS 9 environment, when a user logs in to Facebook from your game, the Hive platform uses the Safari View Controller to perform Facebook login through a Safari webview. Therefore, switching from the game app to the Facebook app does not occur, and login can be processed using the browser inside the app. Facebook recommends that you register the Facebook Scheme in the whitelist by default. View Facebook SDK documentation

  1. Select your project from the project navigator in the Xcode project window.
  2. Select your app from the TARGETS list.
  3. Click the Info tab.
  4. Click LSApplicationQueriesSchemes in the Info tab, click the + button, and add the following two Schemes:
    • fbapi
    • fb-messenger-share-api


You can also add the following code directly to the Info.plist file.

"LSApplicationQueriesSchemes" : [
 "fbapi", 
 "fb-messenger-share-api"
]

QQ IdP setup

Here are the instructions for setting up the QQ IdP.

Adding QQ scheme to whitelist

To add the QQ Scheme to the whitelist, you can either use the project window or add the code directly to the Info.plist file.

  1. Select your project from the project navigator in the Xcode project window.
  2. Select your app from the TARGETS list.
  3. Click the Info tab.
  4. Click LSApplicationQueriesSchemes in the Info tab, click the + button, and add the following Schemes:
    • mqqOpensdkSSoLogin
    • mqqopensdkapiV2
    • mqqopensdkapiV3
    • wtloginmqq2
    • mqq
    • mqqapi
    • mqqopensdknopasteboard
    • mqqopensdknopasteboardios16

You can also add the following code directly to the Info.plist file.

"LSApplicationQueriesSchemes" : [
 "mqqOpensdkSSoLogin",
 "mqqopensdkapiV2",
 "mqqopensdkapiV3",
 "wtloginmqq2",
 "mqq",
 "mqqapi"
]

VK IdP setup

Here are the instructions for setting up the VK IdP.

Entering VK AppID

Follow the instructions below to enter the VK AppID in your Xcode project.

  1. Select your project from the project navigator in the Xcode project window.
  2. Select your app from the TARGETS list.
  3. Click the Info tab.
  4. Click the Custom iOS Target Properties item in the Info tab and add the VK data (vkauthorize, vk-share, vk) to LSApplicationQueriesShcemes.
  5. Click the URL Types item in the Info tab, then click the + icon to create an Additional url type properties item.
  6. Enter the VK AppID with vk prefix (example: Vk1231234) in the URL Schemes field under the Additional url type properties item.

WeChat IdP setup

Here are the instructions for setting up the WeChat IdP.

Entering WeChat appid

Follow the instructions below to enter the WeChat AppID in your Xcode project.

  1. Select your project from the project navigator in the Xcode project window.
  2. Select your app from the TARGETS list.
  3. Click the Info tab.
  4. Click the URL Types item in the Info tab, then click the + icon to create an Additional url type properties item.
  5. Enter Identifier: weixin, weixinULAPI, URL Schemes: APP_ID in the URL Schemes field under the Additional url type properties item.
Note

When using WeChat IdP and Hive SDK promotions together, you need to apply Universal Link.

Google IdP setup

Here are the instructions for setting up the Google IdP.

Entering reversed client id

Follow the instructions below to enter the Reversed Client ID in your Xcode project.

  1. Select your project from the project navigator in the Xcode project window.
  2. Select your app from the TARGETS list.
  3. Click the Info tab.
  4. Click the URL Types item in the Info tab, then click the + icon to create an Additional url type properties item.
  5. Enter Identifier as a blank space and URL Schemes as the reversed client ID in the URL Schemes field under the Additional url type properties item.

Line IdP setup

Here are the instructions for setting up the Line IdP.

Modifying podfile

When using the Line IdP, you need to add the following content to the post_install code in the Podfile in your project directory.

post_install do |installer|
   installer.pods_project.targets.each do |target|
       target.build_configurations.each do |config|
            ...
            # Change pod project settings when using linesdkswift
           if ['LineSDKSwift'].include? target.name
               config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
           # Response to a code signing compilation error issue for cocoapods bundle targets that occurs in xcode 14
           elsif config.build_settings['WRAPPER_EXTENSION'] == 'bundle'
               config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
           end
            ...
       end
   end
end

After saving the Podfile modified as above, run the following command to install the frameworks in your project:

pod install

Entering app bundle id

Follow the instructions below to enter the App Bundle ID in your Xcode project.

  1. Select your project from the project navigator in the Xcode project window.
  2. Select your app from the TARGETS list.
  3. Click the Info tab.
  4. Click the Custom iOS Target Properties item in the Info tab and add LINE data (lineauth2) to LSApplicationQueriesShcemes.
  5. Click the URL Types item in the Info tab, then click the + icon to create an Additional url type properties item.
  6. Enter the app bundle ID with line3rdp prefix (example: line3rdp.$(PRODUCT\_BUNDLE\_IDENTIFIER)) in the URL Schemes field under the Additional url type properties item.
Warning

After implementing the LINE login feature, you must also add it to the IdP connection status information.