Exemple #1
0
    public void EmailPasswordLoginSuccess(UUnitTestContext testContext)
    {
        const string email    = "*****@*****.**";
        const string password = "******";
        const string username = "******";

        _emailAuthService          = new PlayFabAuthService();
        _emailAuthService.Email    = email;
        _emailAuthService.Password = password;
        _emailAuthService.Username = username;

        _emailAuthService.OnLoginSuccess += (success) =>
        {
            testContext.True(!string.IsNullOrEmpty(success.PlayFabId));
            testContext.NotNull(_emailAuthService.IsClientLoggedIn());
            testContext.EndTest(UUnitFinishState.PASSED, "Email & password auth success. " + success.PlayFabId);
        };
        _emailAuthService.OnPlayFabError += (error) =>
        {
            testContext.Fail("Email & password auth failed with error: " + error.GenerateErrorReport());
        };
        _emailAuthService.OnDisplayAuthentication += () =>
        {
            testContext.Fail("Email & password auth failed.");
        };
        _emailAuthService.Authenticate(AuthTypes.EmailPassword);
    }
Exemple #2
0
        public void Authenticate(PlayFabAuthService authService, Action <LoginResult> resultCallback, Action <PlayFabError> errorCallback, AuthKeys authKeys)
        {
#if UNITY_ANDROID && !UNITY_EDITOR
            PlayFabClientAPI.LoginWithAndroidDeviceID(new LoginWithAndroidDeviceIDRequest
            {
                AndroidDevice         = SystemInfo.deviceModel,
                OS                    = SystemInfo.operatingSystem,
                AndroidDeviceId       = PlayFabSettings.DeviceUniqueIdentifier,
                CreateAccount         = true,
                InfoRequestParameters = authService.InfoRequestParams
            }, resultCallback, errorCallback);
#elif UNITY_IPHONE || UNITY_IOS && !UNITY_EDITOR
            PlayFabClientAPI.LoginWithIOSDeviceID(new LoginWithIOSDeviceIDRequest
            {
                DeviceModel           = SystemInfo.deviceModel,
                OS                    = SystemInfo.operatingSystem,
                DeviceId              = PlayFabSettings.DeviceUniqueIdentifier,
                CreateAccount         = true,
                InfoRequestParameters = authService.InfoRequestParams
            }, resultCallback, errorCallback);
#else
            PlayFabClientAPI.LoginWithCustomID(new LoginWithCustomIDRequest
            {
                CustomId              = authService.GetOrCreateRememberMeId(),
                CreateAccount         = true,
                InfoRequestParameters = authService.InfoRequestParams
            }, resultCallback, errorCallback);
#endif
        }
 public void Authenticate(PlayFabAuthService authService, Action <LoginResult> resultCallback, Action <PlayFabError> errorCallback, AuthKeys authKeys)
 {
     PlayFabClientAPI.LoginWithNintendoSwitchDeviceId(new LoginWithNintendoSwitchDeviceIdRequest
     {
         NintendoSwitchDeviceId = PlayFabSettings.DeviceUniqueIdentifier,
         InfoRequestParameters  = authService.InfoRequestParams,
         CreateAccount          = true
     }, resultCallback, errorCallback);
 }
Exemple #4
0
    public void InvalidServiceSetup(UUnitTestContext testContext)
    {
        var authService = new PlayFabAuthService();

        authService.OnDisplayAuthentication += () => testContext.EndTest(UUnitFinishState.PASSED, "Invoke display as expected.");
        authService.OnLoginSuccess          += (success) => testContext.Fail("Invoke display expected.");
        authService.OnPlayFabError          += (error) => testContext.EndTest(UUnitFinishState.PASSED, "Error is not expected.");
        authService.Authenticate(AuthTypes.UsernamePassword);
    }
        public void Authenticate(PlayFabAuthService authService, Action <LoginResult> resultCallback, Action <PlayFabError> errorCallback, AuthKeys authKeys)
        {
            // If username & password is empty, then do not continue, and Call back to Authentication UI Display
            if (!authService.RememberMe && string.IsNullOrEmpty(authService.Email) && string.IsNullOrEmpty(authService.Password))
            {
                authService.InvokeDisplayAuthentication();
                return;
            }

            // We have not opted for remember me in a previous session, so now we have to login the user with email & password.
            PlayFabClientAPI.LoginWithEmailAddress(new LoginWithEmailAddressRequest
            {
                Email    = authService.Email,
                Password = authService.Password,
                InfoRequestParameters = authService.InfoRequestParams,
                TitleId = PlayFabSettings.TitleId
            },
                                                   resultCallback,
                                                   error =>
            {
                // If user not registered, create one with RegisterPlayFabUser, because LoginWithEmailAddressRequest does not contains "CreateAccount" option.
                if (error.Error == PlayFabErrorCode.AccountNotFound)
                {
                    UnityEngine.Debug.LogWarning("Authentication failed. Try to register account.");
                    PlayFabClientAPI.RegisterPlayFabUser(new RegisterPlayFabUserRequest
                    {
                        Username = authService.Username,
                        Password = authService.Password,
                        Email    = authService.Email,
                        InfoRequestParameters = authService.InfoRequestParams,
                        TitleId = PlayFabSettings.TitleId
                    },
                                                         (registerSuccess) =>
                    {
                        // convert RegisterResult to LoginResult
                        resultCallback.Invoke(new LoginResult
                        {
                            AuthenticationContext = registerSuccess.AuthenticationContext,
                            EntityToken           = registerSuccess.EntityToken,
                            CustomData            = registerSuccess.CustomData,
                            NewlyCreated          = true,
                            PlayFabId             = registerSuccess.PlayFabId,
                            SessionTicket         = registerSuccess.SessionTicket,
                            SettingsForUser       = registerSuccess.SettingsForUser,
                            Request       = registerSuccess.Request,
                            LastLoginTime = DateTime.UtcNow
                        });
                    }, errorCallback);
                }
                // otherwise return error
                else
                {
                    errorCallback.Invoke(error);
                }
            });
        }
Exemple #6
0
        public void Authenticate(PlayFabAuthService authService, Action <LoginResult> resultCallback, Action <PlayFabError> errorCallback, AuthKeys authKeys)
        {
            if (string.IsNullOrEmpty(authService.Username) || string.IsNullOrEmpty(authService.Password) || string.IsNullOrEmpty(authService.Email))
            {
                authService.InvokeDisplayAuthentication();
                return;
            }

            PlayFabClientAPI.LoginWithPlayFab(new LoginWithPlayFabRequest
            {
                InfoRequestParameters = authService.InfoRequestParams,
                Password = authService.Password,
                Username = authService.Username,
                TitleId  = PlayFabSettings.TitleId
            },
                                              resultCallback,
                                              error =>
            {
                // If user not registered, create one.
                // Do it because LoginWithPlayFabRequest does not contains "CreateAccount" option.
                if (error.Error == PlayFabErrorCode.AccountNotFound)
                {
                    UnityEngine.Debug.LogWarning("Authentication failed. Try to register account.");
                    PlayFabClientAPI.RegisterPlayFabUser(new RegisterPlayFabUserRequest
                    {
                        Username = authService.Username,
                        Password = authService.Password,
                        Email    = authService.Email,
                        InfoRequestParameters = authService.InfoRequestParams,
                        TitleId = PlayFabSettings.TitleId
                    },
                                                         (registerSuccess) =>
                    {
                        // convert RegisterResult to LoginResult
                        resultCallback.Invoke(new LoginResult
                        {
                            AuthenticationContext = registerSuccess.AuthenticationContext,
                            EntityToken           = registerSuccess.EntityToken,
                            CustomData            = registerSuccess.CustomData,
                            NewlyCreated          = true,
                            PlayFabId             = registerSuccess.PlayFabId,
                            SessionTicket         = registerSuccess.SessionTicket,
                            SettingsForUser       = registerSuccess.SettingsForUser,
                            Request       = registerSuccess.Request,
                            LastLoginTime = DateTime.UtcNow
                        });
                    }, errorCallback);
                }
                // otherwise return error
                else
                {
                    errorCallback.Invoke(error);
                }
            });
        }
Exemple #7
0
        public void Link(PlayFabAuthService authService, AuthKeys authKeys)
        {
            Authenticate(authService, resultCallback =>
            {
#if UNITY_ANDROID && !UNITY_EDITOR
                PlayFabClientAPI.LinkAndroidDeviceID(new LinkAndroidDeviceIDRequest
                {
                    AndroidDeviceId       = PlayFabSettings.DeviceUniqueIdentifier,
                    AuthenticationContext = authService.AuthenticationContext,
                    AndroidDevice         = SystemInfo.deviceModel,
                    OS        = SystemInfo.operatingSystem,
                    ForceLink = authService.ForceLink
                }, linkCallback =>
                {
                    authService.InvokeLink(AuthTypes.Silent);
                }, errorCallback =>
                {
                    authService.InvokeLink(AuthTypes.Silent, errorCallback);
                });
#elif UNITY_IPHONE || UNITY_IOS && !UNITY_EDITOR
                PlayFabClientAPI.LinkIOSDeviceID(new LinkIOSDeviceIDRequest
                {
                    DeviceId = PlayFabSettings.DeviceUniqueIdentifier,
                    AuthenticationContext = authService.AuthenticationContext,
                    DeviceModel           = SystemInfo.deviceModel,
                    OS        = SystemInfo.operatingSystem,
                    ForceLink = authService.ForceLink
                }, linkCallback =>
                {
                    authService.InvokeLink(AuthTypes.Silent);
                }, errorCallback =>
                {
                    authService.InvokeLink(AuthTypes.Silent, errorCallback);
                });
#else
                PlayFabClientAPI.LinkCustomID(new LinkCustomIDRequest
                {
                    CustomId = authService.GetOrCreateRememberMeId(),
                    AuthenticationContext = authService.AuthenticationContext,
                    ForceLink             = authService.ForceLink
                }, linkCallback =>
                {
                    authService.InvokeLink(AuthTypes.Silent);
                }, errorCallback =>
                {
                    authService.InvokeLink(AuthTypes.Silent, errorCallback);
                });
#endif
            }, errorCallback =>
            {
                authService.InvokeLink(AuthTypes.Silent, errorCallback);
            }, authKeys);
        }
 public void Unlink(PlayFabAuthService authService, AuthKeys authKeys)
 {
     PlayFabClientAPI.UnlinkGoogleAccount(new UnlinkGoogleAccountRequest
     {
         AuthenticationContext = authService.AuthenticationContext,
     }, resultCallback =>
     {
         authService.InvokeUnlink(AuthTypes.GooglePlayGames);
     }, errorCallback =>
     {
         authService.InvokeUnlink(AuthTypes.GooglePlayGames, errorCallback);
     });
 }
Exemple #9
0
 public void Unlink(PlayFabAuthService authService, AuthKeys authKeys)
 {
     PlayFabClientAPI.UnlinkTwitch(new UnlinkTwitchAccountRequest
     {
         AuthenticationContext = authService.AuthenticationContext,
     }, resultCallback =>
     {
         authService.InvokeUnlink(AuthTypes.Twitch);
     }, errorCallback =>
     {
         authService.InvokeUnlink(AuthTypes.Twitch, errorCallback);
     });
 }
Exemple #10
0
 public void Unlink(PlayFabAuthService authService, AuthKeys authKeys)
 {
     PlayFabClientAPI.UnlinkOpenIdConnect(new UninkOpenIdConnectRequest
     {
         AuthenticationContext = authService.AuthenticationContext,
         ConnectionId          = authKeys.OpenIdConnectionId
     }, resultCallback =>
     {
         authService.InvokeUnlink(AuthTypes.OpenId);
     }, errorCallback =>
     {
         authService.InvokeUnlink(AuthTypes.OpenId, errorCallback);
     });
 }
 public void Unlink(PlayFabAuthService authService, AuthKeys authKeys)
 {
     PlayFabClientAPI.UnlinkWindowsHello(new UnlinkWindowsHelloAccountRequest
     {
         AuthenticationContext = authService.AuthenticationContext,
         PublicKeyHint         = authKeys.AuthTicket
     }, resultCallback =>
     {
         authService.InvokeUnlink(AuthTypes.WindowsHello);
     }, errorCallback =>
     {
         authService.InvokeUnlink(AuthTypes.WindowsHello, errorCallback);
     });
 }
Exemple #12
0
    // Use this for initialization
    void Start()
    {
        _authService = PlayFabAuthService.Instance;
        PlayFabAuthService.OnDisplayAuthentication += OnDisplayAuth;
        PlayFabAuthService.OnLoginSuccess          += OnLoginSuccess;

        _nm = NewNetworkManager.Instance;
        _nm.OnDisconnected.AddListener(OnDisconnected);
        _nm.OnConnected.AddListener(OnConnected);
        NetworkClient.RegisterHandler <ShutdownMessage>(OnServerShutdown);
        NetworkClient.RegisterHandler <MaintenanceMessage>(OnMaintenanceMessage);

        _messageWindow = MessageWindow.Instance;
    }
Exemple #13
0
 public void Unlink(PlayFabAuthService authService, AuthKeys authKeys)
 {
     PlayFabClientAPI.UnlinkXboxAccount(new UnlinkXboxAccountRequest
     {
         AuthenticationContext = authService.AuthenticationContext,
         XboxToken             = authKeys.AuthTicket
     }, resultCallback =>
     {
         authService.InvokeUnlink(AuthTypes.XBoxLive);
     }, errorCallback =>
     {
         authService.InvokeUnlink(AuthTypes.XBoxLive, errorCallback);
     });
 }
Exemple #14
0
 public void Unlink(PlayFabAuthService authService, AuthKeys authKeys)
 {
     PlayFabClientAPI.UnlinkFacebookInstantGamesId(new UnlinkFacebookInstantGamesIdRequest
     {
         AuthenticationContext  = authService.AuthenticationContext,
         FacebookInstantGamesId = authKeys.AuthTicket
     }, resultCallback =>
     {
         authService.InvokeUnlink(AuthTypes.FacebookInstantGames);
     }, errorCallback =>
     {
         authService.InvokeUnlink(AuthTypes.FacebookInstantGames, errorCallback);
     });
 }
 public void Unlink(PlayFabAuthService authService, AuthKeys authKeys)
 {
     PlayFabClientAPI.UnlinkNintendoSwitchDeviceId(new UnlinkNintendoSwitchDeviceIdRequest
     {
         AuthenticationContext  = authService.AuthenticationContext,
         NintendoSwitchDeviceId = PlayFabSettings.DeviceUniqueIdentifier
     }, resultCallback =>
     {
         authService.InvokeUnlink(AuthTypes.NintendoSwitch);
     }, errorCallback =>
     {
         authService.InvokeUnlink(AuthTypes.NintendoSwitch, errorCallback);
     });
 }
 public void Link(PlayFabAuthService authService, AuthKeys authKeys)
 {
     PlayFabClientAPI.LinkKongregate(new LinkKongregateAccountRequest
     {
         KongregateId          = authKeys.AuthTicket,
         AuthenticationContext = authService.AuthenticationContext,
         ForceLink             = authService.ForceLink
     }, resultCallback =>
     {
         authService.InvokeLink(AuthTypes.Kongregate);
     }, errorCallback =>
     {
         authService.InvokeLink(AuthTypes.Kongregate, errorCallback);
     });
 }
Exemple #17
0
        public void Authenticate(PlayFabAuthService authService, Action <LoginResult> resultCallback, Action <PlayFabError> errorCallback, AuthKeys authKeys)
        {
            if (authKeys == null || string.IsNullOrEmpty(authKeys.AuthTicket))
            {
                authService.InvokeDisplayAuthentication();
                return;
            }

            PlayFabClientAPI.LoginWithFacebookInstantGamesId(new LoginWithFacebookInstantGamesIdRequest
            {
                FacebookInstantGamesSignature = authKeys.AuthTicket,
                InfoRequestParameters         = authService.InfoRequestParams,
                CreateAccount = true
            }, resultCallback, errorCallback);
        }
Exemple #18
0
    public void TestSilentLoginAfterUnlink(UUnitTestContext testContext)
    {
        var silentAuth = new PlayFabAuthService();

        silentAuth.OnLoginSuccess += (success) =>
        {
            testContext.True(success.PlayFabId != _emailAuthService.AuthenticationContext.PlayFabId, "Silent auth and email auth playFabIds is match!");
            testContext.EndTest(UUnitFinishState.PASSED, "Silent auth completed as expected. New playFabId: " + success.PlayFabId);
        };
        silentAuth.OnPlayFabError += (error) =>
        {
            testContext.Fail("Silent auth abort with error: " + error.Error.ToString());
        };
        silentAuth.Authenticate(AuthTypes.Silent);
    }
Exemple #19
0
 public void Link(PlayFabAuthService authService, AuthKeys authKeys)
 {
     PlayFabClientAPI.LinkFacebookInstantGamesId(new LinkFacebookInstantGamesIdRequest
     {
         FacebookInstantGamesSignature = authKeys.AuthTicket,
         AuthenticationContext         = authService.AuthenticationContext,
         ForceLink = authService.ForceLink
     }, resultCallback =>
     {
         authService.InvokeLink(AuthTypes.FacebookInstantGames);
     }, errorCallback =>
     {
         authService.InvokeLink(AuthTypes.FacebookInstantGames, errorCallback);
     });
 }
Exemple #20
0
 public void Link(PlayFabAuthService authService, AuthKeys authKeys)
 {
     PlayFabClientAPI.LinkTwitch(new LinkTwitchAccountRequest
     {
         AccessToken           = authKeys.AuthTicket,
         AuthenticationContext = authService.AuthenticationContext,
         ForceLink             = authService.ForceLink
     }, resultCallback =>
     {
         authService.InvokeLink(AuthTypes.Twitch);
     }, errorCallback =>
     {
         authService.InvokeLink(AuthTypes.Twitch, errorCallback);
     });
 }
Exemple #21
0
 public void Link(PlayFabAuthService authService, AuthKeys authKeys)
 {
     PlayFabClientAPI.LinkGameCenterAccount(new LinkGameCenterAccountRequest
     {
         GameCenterId          = authKeys.AuthTicket,
         AuthenticationContext = authService.AuthenticationContext,
         ForceLink             = authService.ForceLink
     }, resultCallback =>
     {
         authService.InvokeLink(AuthTypes.GameCenter);
     }, errorCallback =>
     {
         authService.InvokeLink(AuthTypes.GameCenter, errorCallback);
     });
 }
        public void Authenticate(PlayFabAuthService authService, Action <LoginResult> resultCallback, Action <PlayFabError> errorCallback, AuthKeys authKeys = null)
        {
            if (authKeys == null || string.IsNullOrEmpty(authKeys.WindowsHelloPublicKeyHint) || string.IsNullOrEmpty(authKeys.WindowsHelloChallengeSignature))
            {
                authService.InvokeDisplayAuthentication();
                return;
            }

            PlayFabClientAPI.LoginWithWindowsHello(new LoginWithWindowsHelloRequest
            {
                ChallengeSignature    = authKeys.WindowsHelloChallengeSignature,
                PublicKeyHint         = authKeys.WindowsHelloPublicKeyHint,
                InfoRequestParameters = authService.InfoRequestParams
            }, resultCallback, errorCallback);
        }
 public void Link(PlayFabAuthService authService, AuthKeys authKeys)
 {
     PlayFabClientAPI.LinkGoogleAccount(new LinkGoogleAccountRequest
     {
         ServerAuthCode        = authKeys.AuthTicket,
         AuthenticationContext = authService.AuthenticationContext,
         ForceLink             = authService.ForceLink
     }, resultCallback =>
     {
         authService.InvokeLink(AuthTypes.GooglePlayGames);
     }, errorCallback =>
     {
         authService.InvokeLink(AuthTypes.GooglePlayGames, errorCallback);
     });
 }
Exemple #24
0
    public void LoginWithDeviceId(UUnitTestContext testContext)
    {
        var silentAuth = new PlayFabAuthService();

        silentAuth.OnLoginSuccess += (success) =>
        {
            testContext.StringEquals(_emailAuthService.AuthenticationContext.PlayFabId, success.PlayFabId);
            testContext.EndTest(UUnitFinishState.PASSED, "Silent auth success with playFabId: " + success.PlayFabId);
        };
        silentAuth.OnPlayFabError += (error) =>
        {
            testContext.Fail("Silent auth failed with error: " + error.ErrorMessage);
        };
        silentAuth.Authenticate(AuthTypes.Silent);
    }
Exemple #25
0
 public void Link(PlayFabAuthService authService, AuthKeys authKeys)
 {
     PlayFabClientAPI.LinkOpenIdConnect(new LinkOpenIdConnectRequest
     {
         IdToken               = authKeys.AuthTicket,
         ConnectionId          = authKeys.OpenIdConnectionId,
         AuthenticationContext = authService.AuthenticationContext,
         ForceLink             = authService.ForceLink
     }, resultCallback =>
     {
         authService.InvokeLink(AuthTypes.OpenId);
     }, errorCallback =>
     {
         authService.InvokeLink(AuthTypes.OpenId, errorCallback);
     });
 }
Exemple #26
0
        public void Authenticate(PlayFabAuthService authService, Action <LoginResult> resultCallback, Action <PlayFabError> errorCallback, AuthKeys authKeys)
        {
            if (authKeys == null || string.IsNullOrEmpty(authKeys.AuthTicket) || string.IsNullOrEmpty(authKeys.OpenIdConnectionId))
            {
                authService.InvokeDisplayAuthentication();
                return;
            }

            PlayFabClientAPI.LoginWithOpenIdConnect(new LoginWithOpenIdConnectRequest
            {
                ConnectionId          = authKeys.OpenIdConnectionId,
                IdToken               = authKeys.AuthTicket,
                InfoRequestParameters = authService.InfoRequestParams,
                CreateAccount         = true
            }, resultCallback, errorCallback);
        }
 public void Link(PlayFabAuthService authService, AuthKeys authKeys)
 {
     PlayFabClientAPI.LinkWindowsHello(new LinkWindowsHelloAccountRequest
     {
         PublicKey             = authKeys.AuthTicket,
         AuthenticationContext = authService.AuthenticationContext,
         ForceLink             = authService.ForceLink,
         UserName = authService.Username
     }, resultCallback =>
     {
         authService.InvokeLink(AuthTypes.WindowsHello);
     }, errorCallback =>
     {
         authService.InvokeLink(AuthTypes.WindowsHello, errorCallback);
     });
 }
Exemple #28
0
    public void InvalidEmailPasswordLogin(UUnitTestContext testContext)
    {
        const string password = "******";
        const string username = "******";
        const string email    = "LoginTest.com";

        var authService = new PlayFabAuthService();

        authService.Password = password;
        authService.Username = username;
        authService.Email    = email;

        authService.OnLoginSuccess          += (success) => testContext.Fail("Login fail expected.");
        authService.OnPlayFabError          += (error) => testContext.EndTest(UUnitFinishState.PASSED, "Error handle as expected.");
        authService.OnDisplayAuthentication += () => testContext.Fail("Failed with unknown error.");

        authService.Authenticate(AuthTypes.UsernamePassword);
    }
Exemple #29
0
        public void Unlink(PlayFabAuthService authService, AuthKeys authKeys)
        {
            Authenticate(authService, resultCallback =>
            {
#if UNITY_ANDROID && !UNITY_EDITOR
                PlayFabClientAPI.UnlinkAndroidDeviceID(new UnlinkAndroidDeviceIDRequest()
                {
                    AndroidDeviceId       = PlayFabSettings.DeviceUniqueIdentifier,
                    AuthenticationContext = authService.AuthenticationContext
                }, unlinkCallback =>
                {
                    authService.InvokeUnlink(AuthTypes.Silent);
                }, errorCallback =>
                {
                    authService.InvokeUnlink(AuthTypes.Silent, errorCallback);
                });
#elif UNITY_IPHONE || UNITY_IOS && !UNITY_EDITOR
                PlayFabClientAPI.UnlinkIOSDeviceID(new UnlinkIOSDeviceIDRequest()
                {
                    DeviceId = PlayFabSettings.DeviceUniqueIdentifier,
                    AuthenticationContext = authService.AuthenticationContext
                }, unlinkCallback =>
                {
                    authService.InvokeUnlink(AuthTypes.Silent);
                }, errorCallback =>
                {
                    authService.InvokeUnlink(AuthTypes.Silent, errorCallback);
                });
#else
                PlayFabClientAPI.UnlinkCustomID(new UnlinkCustomIDRequest
                {
                    CustomId = authService.GetOrCreateRememberMeId(),
                    AuthenticationContext = authService.AuthenticationContext
                }, unlinkCallback =>
                {
                    authService.InvokeUnlink(AuthTypes.Silent);
                }, errorCallback =>
                {
                    authService.InvokeUnlink(AuthTypes.Silent, errorCallback);
                });
#endif
            }, errorCallback => authService.InvokeUnlink(AuthTypes.Silent, errorCallback), authKeys);
        }
Exemple #30
0
    public void InvalidUnlink(UUnitTestContext testContext)
    {
        var authService = new PlayFabAuthService();

        authService.OnPlayFabUnlink += (auth, error) =>
        {
            if (error != null)
            {
                testContext.EndTest(UUnitFinishState.PASSED, "Error handle as expected. " + error.GenerateErrorReport());
            }
            else
            {
                testContext.Fail("Error expected.");
            }
        };
        authService.Unlink(new AuthKeys {
            AuthType = AuthTypes.Facebook
        });
    }