private static ResponseBodyContent Authorization() { // Initialize a request to Auth0 var authUrl = ConfigurationManager.AppSettings["auth_token_url"]; if (string.IsNullOrEmpty(authUrl)) { Console.WriteLine("// No auth0 url set"); return(null); } var client = new RestClient(authUrl); var request = new RestRequest(Method.POST); request.AddHeader("Content-Type", "application/json"); // Filling up the request body using configs in app.config var content = new RequestBodyContent(); request.AddParameter("application/json", content.ToJson(), ParameterType.RequestBody); // Getting Auth0 access token var response = client.Execute(request); var responseContent = response.Content.ParseToResponseBodyContent(); // Output if we got the token from Auth0 Console.WriteLine($"// Auth0 GET Token Status: {(response.StatusCode == HttpStatusCode.OK ? "Succeeded" : $"Failed ({response.StatusCode})")}");
/// <summary> /// Obtiene de la bd los parámetros para el servicio /// </summary> /// <returns></returns> private RequestBodyContent GetBodyContent() { RequestBodyContent _GetBodyContent = null; try { SyncRepository sync = new SyncRepository(); using (var entity = new db_SeguimientoProtocolo_r2Entities()) { var res = entity.spGetMaxTableCiRegistroRecurrent().FirstOrDefault(); if (res != null) { _GetBodyContent = new RequestBodyContent() { fechaActual =(long)res.FechaInicio, //sync.GetCurrentDate(), fechaFin = (long)res.FechaFin, LastModifiedDate = (long)res.LastModifiedDate, ServerLastModifiedDate = (long)res.ServerLastModifiedDate }; } } } catch (Exception ex) { throw ex; } return _GetBodyContent; }