/// <summary> /// Login /// </summary> public void SignIn(string username, string password, bool remember_user, Action <XsollaUser> onSuccessfulSignIn, Action <ErrorDescription> onError) { var loginData = new LoginData(); loginData.username = username; loginData.password = password; loginData.remember_me = remember_user; var loginDataJson = JsonUtility.ToJson(loginData); string proxy = _isProxy ? "proxy/" : string.Empty; StartCoroutine(WebRequests.PostRequest( string.Format("https://login.xsolla.com/api/{0}login?projectId={1}&login_url={2}&engine=unity&engine_v={3}&sdk=login&sdk_v={4}", proxy, _loginId, _callbackURL, Application.unityVersion, sdk_v), loginDataJson, (status, message) => { ErrorDescription error = CheckForErrors(status, message, CheckSignInError); if (error != null) { if (onError != null) { onError.Invoke(error); } return; } Action <XsollaUser> onSuccess = (xsollaUser) => { if (onSuccessfulSignIn != null) { onSuccessfulSignIn.Invoke(xsollaUser); } if (remember_user) { SaveLoginPassword(username, password); } }; if (_isJWTValidationToken) { JWTValidation(message, (xsollaUser, errorDescription) => { if (errorDescription != null && onError != null) { onError.Invoke(errorDescription); } else { onSuccess.Invoke(xsollaUser); } }); } else { onSuccess.Invoke(new XsollaUser()); } } )); }