Currently, we provide a Login Sample which demonstrates the use of the Auth Interface to login with the SDK.
You can also optionally enable native Sign in with Apple (SIWA) support in this sample, but you will need to use a bundle identifier and provisioning profile with this feature enabled. Additional settings adjustments required are noted later on. By default this feature is disabled.
This page will walk you through using the Login Sample on iOS with both the standard login flow and the SIWA flow. This sample has been developed using Xcode 11.3.1 and iOS SDK 13.2.
Before You Begin
Make sure you have correctly set the values associated with your application in
Login/Settings/settings.json. Without these, the SDK will fail to run correctly. The required settings are:
productId: Your product id
sandboxId: Your sandbox id
deploymentId: Your deployment id
clientId: Your client id
clientSecret: Your client secret
If you don't yet have the values for these settings, you can learn more about them at Developer Portal (link to doc).
Some additional Xcode settings also need to be configured:
Login/Info.plistand navigate to the URL types > Item 0 > URL Schemes > Item 0. This value must be set to
eos.clientId, where clientId is the same as the data in the json file. This allows the account portal to re-trigger your application with resulting login data from the web.
EOSSDK.frameworkto the Login/Frameworks folder.
You will also need to set a bundle identifier in the Signing & Capabilities settings, so that you can build and sign the sample.
Sign In With Apple
Sign in with Apple is only available on iOS 13+.
Some additional settings are required in Xcode to enable SIWA support in this sample.
Your bundle identifier needs to have the Sign in with Apple capability enabled in the Apple Developer portal under Certificates, Identifiers & Profiles, within Identifiers.
In the Signing & Capabilities settings for the project, use the + Capability option to add Sign in with Apple support to your application.
In Build Settings, locate Swift Compiler - Custom Flags > Active Compilation Conditions, and add the define
EOS_ENABLE_SIWAto both Debug and Release fields.
When you first start the app, you will be presented with a screen that contains a login button. If you have enabled SIWA, you will see two login options.
Each time you open the app, it will attempt to automatically log in with the last credentials you logged in with, using persistent auth. If you have not previously logged in, persistent auth will of course fail to find any existing credentials.
Logging In With the Account Portal
When you press the Login button, a secure session is started, and the OS will prompt you to continue the login process in a browser. This prompt tells you the name of the application, and the target domain that will be opened in the browser.
When you press Continue, a browser will open on the Epic account portal prompting you to sign into your Epic account.
When this flow is completed, you will be returned to the app, where the login will be confirmed.
From here, you can log out, or you can terminate the application and reopen it to observe the persistent login flow.
Logging In With SIWA (Sign In With Apple)
If you have built the sample with SIWA enabled, when you start the app you will be presented with a screen that contains two login buttons. The top button will take you through the login flow on the account portal from the previous section. When you press the Sign in with Apple button, you will be taken though the SIWA flow.
If this is the first time you have used SIWA you will be asked what data you want to share with the application—for example, your name/email address (See official Apple documentation for more information). On subsequent sign-ins you will be asked to confirm your identity.
When this flow is completed, you will be returned to the app, where the Connect login will be confirmed.
From here, you can select Back to return to the other login options.