Open nilaydigiwhiz opened 6 years ago
Thanks @nilaydigiwhiz. I'm just making a quick note for myself to look at the API docs.
Model: https://github.com/scyllagroup/UmbracoFlare/blob/master/UmbracoFlare/Models/UserDetails.cs
API Doc: https://api.cloudflare.com/#user-user-details
Looks like we need to add the "id" property and remove the "api_key" property to get back to spec.
We encountered the same problem but despite updating the model as indicated by @markadrake the problem still persisted.
Turns out that CloudFlare is currently returning a message on the response which is a collection of complex types (rather than just a string which UmbracoFlare is expecting). One of the properties of the response is as follows:
message: "This API call was made using TLSv1. TLS versions below 1.2 will no longer be supported as of June 4, 2018. You must upgrade your client before then or your API calls will fail. See https://support.cloudflare.com/hc/en-us/articles/360002771651-TLS-1-2-required-for-api-cloudflare-com for details."
If you are running .NET 4.5.x then one way of fixing this is to upgrade to 4.6 as that defaults to TLS 1.2.
Of course the UmbracoFlare model "UserDetails" still needs to be updated and it might be worth updating the "Messages" type in "BasicCloudflareResponse.cs" as well to match what is being returned.
Hi @CaB-Studios, we did a new release that enabled TLS 1.2 and I think addressed the remaining issues here. I'm going to circle back around with the team and verify that UserDetails and Messages are in order. Sorry about these delays. Thanks mate!
UserDetails.cs model is not matching with https://api.cloudflare.com/client/v4/user response and thats why its throwing at UmbracoFlare.ApiControllers.CloudflareApiController.GetUserDetails() ---> (Inner Exception #0) Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: {. Path 'messages', line 1, position 521. at Newtonsoft.Json.JsonTextReader.ReadStringValue(ReadType readType) at Newtonsoft.Json.JsonTextReader.ReadAsString() at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ReadForType(JsonReader reader, JsonContract contract, Boolean hasConverter) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) at System.Net.Http.Formatting.BaseJsonMediaTypeFormatter.ReadFromStream(Type type, Stream readStream, Encoding effectiveEncoding, IFormatterLogger formatterLogger) at System.Net.Http.Formatting.JsonMediaTypeFormatter.ReadFromStream(Type type, Stream readStream, Encoding effectiveEncoding, IFormatterLogger formatterLogger) at System.Net.Http.Formatting.BaseJsonMediaTypeFormatter.ReadFromStream(Type type, Stream readStream, HttpContent content, IFormatterLogger formatterLogger) at System.Net.Http.Formatting.BaseJsonMediaTypeFormatter.ReadFromStreamAsync(Type type, Stream readStream, HttpContent content, IFormatterLogger formatterLogger)