// MÉTODO PARA OBTENER EL TOKEN public static BearerToken ObtenerToken(ClienteAlterno cliente) { string controlador = "/api/token/GetToken"; string endpoint = urlbase + controlador; var client = new RestClient(endpoint); client.Timeout = -1; var request = new RestRequest(Method.POST); request.AddHeader("Content-Type", "application/json"); request.AddHeader("Cookie", "ak_bmsc=1B2DBCB5D80264AA0698B7F0AC518ABCBDF7CF37470800008F7F6B5FEC0F897A~pl/oJgJTrrHhbQTqb4FK0MGGUg6rCfUibWDDgML6mVfnc4voiQnt0bN75qp83XTuKTyEYCh1U6ILMXH71QaJF37B601rg6tJevK8K916oHEpaRqXtKR5ZSwK3VdkH4iyYUQkBJ1zWg+EdCpLPKeFsgVRlVEVKw7YAvgO9i9qbQm9Vx3zIpWWf6xCDcBOa4a6tMYWPEhvRoZ8WlS3llWtt/JuSf67BcnsZk1QiCnyxOEuE="); request.AddParameter("application/json", cliente.ToJson(), ParameterType.RequestBody); IRestResponse response = client.Execute(request); return(BearerToken.FromJson(response.Content)); }
public static string ToJson(this ClienteAlterno self) => JsonConvert.SerializeObject(self, Converter.Settings);