public void LoginWithAppleId(
            LoginOptions loginOptions,
            Action <ICredential> successCallback,
            Action <IAppleError> errorCallback)
        {
#if UNITY_IOS && !UNITY_EDITOR
            var requestId = NativeMessageHandler.AddMessageCallback(
                this._scheduler,
                true,
                payload =>
            {
                var response = this._payloadDeserializer.DeserializeLoginWithAppleIdResponse(payload);
                if (response.Error != null)
                {
                    errorCallback(response.Error);
                }
                else
                {
                    successCallback(response.AppleIDCredential);
                }
            });

            PInvoke.AppleAuth_IOS_LoginWithAppleId(requestId, (int)loginOptions);
#else
            throw new Exception("Apple Auth is only supported for iOS 13.0 onwards");
#endif
        }
Пример #2
0
        public void LoginWithAppleId(
            AppleAuthLoginArgs loginArgs,
            Action <ICredential> successCallback,
            Action <IAppleError> errorCallback)
        {
#if APPLE_AUTH_MANAGER_NATIVE_IMPLEMENTATION_AVAILABLE
            var loginOptions = loginArgs.Options;
            var nonce        = loginArgs.Nonce;
            var requestId    = CallbackHandler.AddMessageCallback(
                true,
                payload =>
            {
                var response = this._payloadDeserializer.DeserializeLoginWithAppleIdResponse(payload);
                if (response.Error != null)
                {
                    errorCallback(response.Error);
                }
                else
                {
                    successCallback(response.AppleIDCredential);
                }
            });

            PInvoke.AppleAuth_IOS_LoginWithAppleId(requestId, (int)loginOptions, nonce);
#else
            throw new Exception("AppleAuthManager is not supported in this platform");
#endif
        }