Sign in with Apple

As you may already know, if you are using third-party or social login service (such as Facebook Login, Google Sign-In, Sign in with Twitter, Sign In with LinkedIn, Login with Amazon, or WeChat Login) you will be also required to add Apple Sing in into your application.

AppStore review guidelines:

https://developer.apple.com/app-store/review/guidelines/#sign-in-with-apple

4.8 Sign in with Apple

Apps that exclusively use a third-party or social login service (such as Facebook Login, Google Sign-In, Sign in with Twitter, Sign In with LinkedIn, Login with Amazon, or WeChat Login) to set up or authenticate the user’s primary account with the app must also offer Sign in with Apple as an equivalent option. A user’s primary account is the account they establish with your app for the purposes of identifying themselves, signing in, and accessing your features and associated services.

Sign in with Apple is not required if:
  • Your app exclusively uses your company’s own account setup and sign-in systems.
  • Your app is an education, enterprise, or business app that requires the user to sign in with an existing education or enterprise account.
  • Your app uses a government or industry-backed citizen identification system or electronic ID to authenticate users.
  • Your app is a client for a specific third-party service and users are required to sign in to their mail, social media, or other third-party account directly to access their content.

So let's talk how you can add Apple Sing in into your Game / Project:

Enable AuthenticationServices

Make sure that AuthenticationServices is enabled in the plugin settings before you start implementation:

Implement Sing in Flow

Code snippet how to start sign-in flow below. You can begin sing-in as soon as the user clicks on the sing in button in your app.

using SA.iOS.UIKit;
using SA.iOS.AuthenticationServices;
...

var provider = new ISN_ASAuthorizationAppleIDProvider();
var request = provider.CreateRequest();

var requests = new ISN_ASAuthorizationRequest[] { request };
var authorizationController = new ISN_ASAuthorizationController(requests);

var @delegate = new AuthorizationDelegateExample();
authorizationController.SetDelegate(@delegate);
authorizationController.PerformRequests();

The result delivered into the delegate you set to ISN_ASAuthorizationController. Here is  AuthorizationDelegateExample class implementation that was used as a delegate instance in the previous snippet.

using SA.Foundation.Templates;
using SA.iOS.AuthenticationServices;
using UnityEngine;

public class AuthorizationDelegateExample : ISN_IASAuthorizationControllerDelegate
{
    public void DidCompleteWithAuthorization(ISN_ASAuthorizationAppleIDCredential credential)
    {
        Debug.LogError("Apple Sing In Completed: ");
        Debug.Log("credential.User: " + credential.User);
        Debug.Log("credential.Email: " + credential.Email);
        Debug.Log("credential.State: " + credential.State);
        
        Debug.Log("credential.AuthorizationCode: " + credential.AuthorizationCode);
        Debug.Log("credential.IdentityToken: " + credential.IdentityToken);
        
        Debug.Log("credential.FullName.Nickname: " + credential.FullName.Nickname);
        Debug.Log("credential.FullName.FamilyName: " + credential.FullName.FamilyName);
        Debug.Log("credential.FullName.GivenName: " + credential.FullName.GivenName);
        Debug.Log("credential.FullName.MiddleName: " + credential.FullName.MiddleName);
        Debug.Log("credential.FullName.NamePrefix: " + credential.FullName.NamePrefix);
        Debug.Log("credential.FullName.NameSuffix: " + credential.FullName.NameSuffix);
    }

    public void DidCompleteWithError(SA_Error error)
    {
        Debug.LogError("Apple Sing In Failed: " + error.FullMessage);
    }
}