Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Apple Sign In Plugin

Let your users authorize with their Apple ID account on iOS devices.

Simple Authorization

Use Apple sign in to authenticate your users without requiring manual account creation.

All-in-one UI

Add a fully functional Apple sign in button in a single line of code.

Overview

Apple sign in lets your users authenticate with your app with their Apple ID. This way you can identify users and they do not have to manually create a separate account for your app or game.

Note: The plugin currently only supports iOS-based devices.

The Apple sign in plugin supports the following features:

  • Authentication: Let your users sign into your app or game with their Apple ID. You can then identify them by their e-mail address, identity token and more. See the AppleSignIn page for more information.
  • Pre-configured user interface: AppleSignIn button allows you to add an all-in-one button for authentication to your app or game.

Example Usage

The following examples show the simplest way to integrate Apple Sign In into your app or game. The AppleSignInButton automatically handles sign in state and plugin availability.

 import QtQuick
 import Felgo

 App {
   AppPage {
     Column {
       AppleSignInButton {
         id: appleSignInButton
       }

       AppText {
         text: !appleSignInButton.visible
               ? "Apple Sign-in unavailable."
               : appleSignInButton.appleSignIn.isLoggedIn
                 ? "Signed in with Apple user: " + appleSignInButton.appleSignIn.userName
                 : "Click above button to sign in with Apple user"
       }
     }
   }
 }

For more detailed usage, see the AppleSignInButton documentation.

You can also sign in your user manually without the pre-configured button. For this use the logic-only component AppleSignIn. Example:

 import QtQuick
 import Felgo

 App {
   AppPage {
     Column {
       AppleSignIn {
         id: appleSignIn
       }

       AppButton {
         enabled: appleSignIn.isAvailable
         text: "Sign in with Apple"
         onClicked: appleSignIn.signIn()
       }

       AppText {
         text: appleSignIn.isSignedIn ? "Signed in as: " + appleSignIn.userName : "Not signed in."
       }
     }
   }
 }

Available QML Items

AppleSignIn

Lets your users sign in with their Apple account

AppleSignInButton

A pre-configured button for Apple account sign in

Adding and Activating Plugins

How to Add a Felgo Plugin to your App or Game

When you create a new project, you can choose to add example plugin integrations as well. Open Qt Creator and choose “File / New File or Project”, then choose Single-Page Application in the Felgo Apps section or any other wizard. For Felgo Games, you can also find an own Game with Plugins project template as an own wizard.

Then select the platforms you want to run your application on. The plugins are available for both iOS & Android. There is a fallback functionality in place on Desktop platforms so your project still works when you call methods of the plugins. This allows you to do the main development on your PC, and for testing the plugin functionality you can run the project on iOS and Android.

After the Kit Selection, you can choose which of the plugins you’d like to add to your project:

Then complete the wizard, your project is now set up with all the correct plugin dependencies for Android & iOS automatically. This includes:

  • Setting up the .gradle file for Android.
  • Setting up the .plist file for iOS.
  • Setting up the CMakeLists.txt file to include the plugin libraries for iOS.

Note: Additional integration steps are still required for most plugins, for example to add the actual plugin libraries for iOS to your project. Please have a look at the integration steps described in the documentation for each of the used plugins.

If you have an existing Felgo application, follow these steps to include a plugin to your app or game:

In Qt Creator, select “File / New File or Project” and choose either Felgo Games or Felgo Apps from Files and Classes. Then select Felgo Plugin and press Choose.

You can now select the plugin you want to add:

The plugin item, which contains the chosen plugin and a short usage example, is now added to your project. To use the item in your project, simply perform these steps:

  • Include the created item (use the name you entered in the template before) in your main.qml file.
  • Modify the CMakeLists.txt file & .plist file for iOS usage. See the iOS integration guide of the chosen plugin for more information.
  • Modify the the .gradle file for Android usage. See the Android integration guide of the chosen plugin for more information.

Note: If you have an existing Qt application, you can also add Felgo Plugins to your app! See here how to do this.

Activating Plugins with a License Key

You can test all plugins as soon as the required integration steps and plugin configuration are completed.

However, the plugins are only available as Trial Versions if they are not activated with a valid license. When you are using unlicensed plugins, a dialog is shown and a watermark overlays your application to notify you about the testing state of the plugin.

All monetization plugins are free to use in all licenses, other plugins are only fully usable if you have purchased the Startup or Business license. To activate plugins and enable their full functionality it is required to create a license key. You can create such a key for your application using the license creation page.

This is how it works:

  • Choose the plugins you want to include in your license key:

  • Click on “Generate License Key” and set the app identifier & version code of your application. You can see that the AdMob plugin was enabled in this license key:

  • Copy the generated licenseKey to your GameWindow or App component.

  • You can now fully use the selected plugins!

Integration

The Apple sign in plugin needs the platform-specific native libraries and configurations. You can integrate them as described here:

Project Configuration

  • Create a file ios/App.entitlements in your project and add the following content:
     <?xml version="1.0" encoding="UTF-8"?>
     <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
     <plist version="1.0">
     <dict>
       <key>com.apple.developer.applesignin</key>
       <array>
         <string>Default</string>
       </array>
     </dict>
     </plist>

    Note: If you already use a .entitlements configuration file, just add the XML content inside that one.

  • Then the following lines of code to your CMakeLists.txt file:
     if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
         set_target_properties(TargetApp PROPERTIES
             XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS
             "${CMAKE_CURRENT_SOURCE_DIR}/ios/TargetApp.entitlements")
    
         target_sources(TargetApp PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/ios/TargetApp.entitlements")
     endif()
  • Link the required Framework to your project by adding:
     set(FELGO_PLUGINS
        applesignin
     )

    Note: Make sure to declare the FELGO_PLUGINS before calling felgo_configure_executable, which links the required Frameworks based on your settings.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded