4 using System.Collections.Generic;
8 using System.Threading.Tasks;
15 public static class CloudIDSage50
19 private static string _lastError =
"";
21 #region Public methods 27 public async
static Task<bool> LoginCloudId(
string prefilledEmail =
"",
string given_name =
"",
string family_name =
"")
29 if (!FUNCTIONS.InternetOk())
31 _lastError =
"Imposible conectar con los servidores de CloudId. Compruebe su conexión a Internet.";
36 if (UseProductionServer())
42 if (_loginData != null)
44 if (_loginData.Success)
47 _lastError = _loginData.AccessToken;
49 return _loginData.Success;
53 _lastError =
"Error indeterminado al intentar ejecutar el Login a CloudID. Revise los log de la aplicación";
62 public async
static Task<bool> RegisterCloudId(
string prefilledEmail =
"",
string given_name =
"",
string family_name =
"")
64 if (!FUNCTIONS.InternetOk())
66 _lastError =
"Imposible conectar con los servidores de CloudId. Compruebe su conexión a Internet.";
71 if (UseProductionServer())
77 if (_loginData != null)
79 if (_loginData.Success)
82 _lastError = _loginData.AccessToken;
84 return _loginData.Success;
88 _lastError =
"Error indeterminado al intentar ejecutar el Login a CloudID. Revise los log de la aplicación";
97 public async
static Task<bool> LogoutCloudId()
99 if (!FUNCTIONS.InternetOk())
101 _lastError =
"Imposible conectar con los servidores de CloudId. Compruebe su conexión a Internet.";
111 _lastError =
"No fue posible cerrar sesión de CloudId";
120 public static string GetAccessToken()
122 return _loginData?.AccessToken;
129 public static string GetRefreshToken()
131 return _loginData?.RefreshToken;
138 public static DateTimeOffset? GetExpirationDate()
140 return _loginData?.ExpirationDate;
147 public static string GetCustomerID()
149 return _loginData?.CustomerID;
156 public static string GetEmail()
158 return _loginData?.Email;
165 public static string GetIdentityToken()
167 return _loginData?.IdentityToken;
174 public static string GetGivenName()
176 return _loginData?.GivenName;
183 public static string GetFamilyName()
185 return _loginData?.FamilyName;
192 public static string GetLastError()
196 #endregion Public methods 198 #region Private methods 199 private static bool UseProductionServer()
204 string pathInicio = Convert.ToString(EW_GLOBAL._GetVariable(
"wc_pathinicio"));
206 bool defaultValue =
true;
208 if (!
string.IsNullOrWhiteSpace(pathInicio))
210 string lEntornoCloudID = FUNCTIONS.LeerConfigIni(
"[CLOUDID_SHADOW]", pathInicio,
"config.ini");
212 if (
string.IsNullOrWhiteSpace(lEntornoCloudID))
214 else if (lEntornoCloudID.ToUpper() ==
"NO")
216 else if (lEntornoCloudID.ToUpper() ==
"SI")
226 #endregion Private methods
async Task< LoginResultSage50 > RegisterS50Async(string predefinedEmail, string predefinedGivenName, string predefinedFamilyName, Auth0Sage50ClientOptions.SageIDEnvironment _sageIDEnvironment)
Basic Asynchronous Registration
async Task< bool > LogoutS50Async()
Basic Asynchronous LogOut
static new AuthorizeSage50 Instance
async Task< LoginResultSage50 > LoginS50Async(string predefinedEmail, string predefinedGivenName, string predefinedFamilyName, Auth0Sage50ClientOptions.SageIDEnvironment _sageIDEnvironment)
Basic Asynchronous Login