0

I originally posted this on GitHub but the plugin author asked me to move it to Stack Overflow.

I'm developing a Xamarin.Forms app. I'm trying do get data from a test API I've setup with OAuth authorisation. I can get the data fine from Postmaster, but always get a null when doing the same query from Furl.

Using Flurl 2.7.1 (latest stable from NuGet) and Flurl.Http 2.3.1 (latest stable from NuGet).

The code is below (it's a test site and token, so I don't mind posting the link and token as they'll be deleted soon).

I know it's authorising ok, because if I change the token I get a 401 (which was also happening originally until I removed 'Bearer' from the beginning of the token).

I'm testing from Visual Studio 2017 Android Emulator. HttpClientImplementation has been set to Android, and SSL/TLS implementation is Native TLS 1.2+.

var list = await "https://cloud.squidex.io/api/content/straktest/experiment?"
  .WithOAuthBearerToken("eyJhbGciOiJSUzI1NiIsImtpZCI6IjkxRkRENEVCRDYwNjMxNURFREI4MENEMDkzMERFRkZBMjFEREE2NkIiLCJ0eXAiOiJKV1QiLCJ4NXQiOiJrZjNVNjlZR01WM3R1QXpRa3czdi1pSGRwbXMifQ.eyJuYmYiOjE1MjY0MTI2NTksImV4cCI6MTUyOTAwNDY1OSwiaXNzIjoiaHR0cHM6Ly9jbG91ZC5zcXVpZGV4LmlvL2lkZW50aXR5LXNlcnZlciIsImF1ZCI6WyJodHRwczovL2Nsb3VkLnNxdWlkZXguaW8vaWRlbnRpdHktc2VydmVyL3Jlc291cmNlcyIsInNxdWlkZXgtYXBpIl0sImNsaWVudF9pZCI6InN0cmFrdGVzdDp0ZXN0Y2xpZW50Iiwic2NvcGUiOlsic3F1aWRleC1hcGkiXX0.ELkBz-vg_gTnGJ9ODXXE5c1AMeYqPmYKxgfgovir6QTxLPRvKNkGeYbzXC6KjGQ4nUdIFzxxjX8_CPVg5MixgHRqzcBSPjLktbCjhkvXMOkSiUNoqnk8uSXmwm_QNZ1XgWZy3d3DPDdMMjliNh0oRbhipwJc9XkqgNFZKylk3-ijCkocbfCLkSH_z2Nt0ikWvL4Ge2zc4udTfsfs2xR4x1hWlFC-iUucw0Vz1LhUAZjRIc0pXPNQvQdTi9bppZ_chUNaJvEY40dcTd-850Z7TQBgN7utrTLbnWnETzWjL4D_KNWDNEfKknJm-4ir08TevfoL08Vd4DmdCjbeJKR8tg")
  .GetAsync();
  //also tried with .GetStringAsync();//.GetJsonListAsync();

Am I doing something wrong?

Thanks, Strak

Strak
  • 99
  • 7
  • `GetAsync()` returns the raw `HttpResponseMessage`. That should never be null, and could provide some hints like `StatusCode`. Are you missing some code in your example? – Todd Menier May 21 '18 at 21:44
  • After checking this again I think I was having a moment in my initial testing. This code DOES work with .GetStringAsync() and .GetJsonAsync(). I think in my first test I must've done .GetJsonListAsync(), which does fail, and messed something up when I tried .GetStringAsync(), either that or there was an issue with the server when I was trying the tests from code, but I don't think so. Anyway, it's working now! – Strak May 22 '18 at 19:15

0 Answers0