Null value returned from Furl using Xamarin.Forms, request works in Postmaster - rest

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

Related

asp.net core 2.1 preview 2 - signalR CORS issues and 405 on OPTIONS request

Using the latest versions of signalR and #aspnet/signalr I still get issues connecting. I'm fairly sure the versions are exactly the same.
I've been following the startup project here. But instead I'm using an Angular 5 application. I get issues with CORS headers and more specifically the OPTIONS request returns a 405 method not allowed.
Visual studio version here.
Typescript/javascript client version here
I faced same issue and it appeared that order matters. Make sure you've put it like this:
app.UseCors(...builder...)
app.UseSignalR(...routes...)
app.UseMvc(...routes...)

Google APIs Explorer posting to remote API instead of local

I'm currently developing a (Java) backend for a mobile application using Google App Engine (SDK v1.8.8) and Cloud Endpoints. I'm using Eclipse (Kepler) with Google Plugin (v3.8.0) to develop/deploy the code.
I've been using Google API's explorer for many months during the development to test the endpoints and up until yesterday, everything was working well... if I ran App Engine locally, I could test the endpoints at:
http://localhost:8888/_ah/api/explorer
Likewise, I could execute against the remotely deployed version at:
https://1-dot-[my-app-id]-app.appspot.com/_ah/api/explorer
...in both cases, everything worked as expected.
However, as of yesterday, local execution no longer works... instead, my requests are sent to the remote (i.e. live!) version of my API. I'm still accessing API Explorer on localhost and according to it's output, my requests are still being posted locally... here is what is printed when I execute a function 'foo' on 'admin' endpoint:
Request
POST `http://localhost:8888/_ah/api/adminendpoint/v1/foo`
X-JavaScript-User-Agent: Google APIs Explorer
However, for some reason, these requests are being sent to the live/deployed instance of the API.
I restarted my browser (Chrome) and cleared it's cache, tried another browser (Safari), restarted the machine, re-deployed the API... It feels like something is being cached somewhere but I'm running out of ideas.
Does anyone have any suggestions?
The error has been fixed in the Google App Engine SDK for Java version 1.9.17, as indicated in the release notes (https://code.google.com/p/googleappengine/wiki/SdkForJavaReleaseNotes). I updated my libraries to 1.9.17, and the APIs explorer started working again for localhost.

PayPal Sandbox API SSL handshake error suddenly started using PayPal PHP SDK?

Up until today, I have been successfully developing with PayPal's sandbox using the new PayPal PHP SDK which comes preconfigured to use this sandbox URL:
https://api.sandbox.paypal.com/2.0/
(URL in Chrome currently returns: "Error 107 (net::ERR_SSL_PROTOCOL_ERROR): SSL protocol error.")
But today my webapp is crashing due to a SSL handshake failure:
Uncaught exception 'PPConnectionException' with message 'error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure' in ./paypal-sdk-1.0.92/lib/PPHttpConnection.php:185
The only event that has occurred since yesterday (when my webapp was last working) was I reset my sandbox "seller" account, which may have reset the API credentials according to this post. Since I've updated the API credentials manually, and have verified them to be correct, I cannot say if they were ever wrong at this point.
After lots of searching, I found other web articles that say the URL should be:
https://api-3t.sandbox.paypal.com/2.0/
(URL in Chrome returns a SOAP response.)
So I changed my PayPal PHP SDK's included URL from https://api.sandbox.paypal.com/2.0/ to https://api-3t.sandbox.paypal.com/2.0/ and it is working perfectly again. What happened here? Is the non-"3t" sandbox URL simply broken right now?
EDIT: After the feedback received from #Win and #JoelP, I have filed a bug report through the PayPal SDK github so someone at PayPal can explain what changed today and fix the SDK to have the correct URL when using Signature credentials.
EDIT 2: PayPal fixed the issue a few days ago. It's going to be available in the next release. https://github.com/paypal/SDKs/issues/22#issuecomment-8660682
Thanks for the help everyone.
Differences are between Certificate and Signature
Signature is the preferred way of accessing PayPal API.
The issue is fixed and the code has been pushed to master branch. You should see the refreshed bundles of the sdk out on x.com in the next couple of days.
Refer GitHub issue here https://github.com/paypalx/SDKs/issues/22
Thanks,
Prasanna.
I can't answer the question but I can say that I have just discovered the same problem. I confirm that jimp's workaround of changing the SDK's service endpoint config to :
service.EndPoint="https://api-3t.sandbox.paypal.com/2.0/"
solved my issue. (This is in the Paypal SDK config/sdk_config.ini file).
In my case I am using the PHP SDK. I have not changed anything on my sandbox account. My best guess is that the original URL is simply down for a while. (Firefox shows the "Secure Connection Failed" alert).

Grails Facebook-Graph Plugin Oauth2

We have been using the Grails Facebook-graph plugin for a while now - it has been working perfectly until earlier this month when FB apparently turned off their old authentication scheme, and indirectly forced everybody to use oauth2 instead.
This post from FB https://developers.facebook.com/blog/post/525/ describes the changes, and the issue in the Grails plugin seems to be that it does not comply with the new standard.
The main issue appears to be in the way the active user data is being maintained in the plugin. This is currently based on the FB provided cookie "fbs", which contains all the necessary session data related to the active user. Unfortunately, this is no longer provided by FB (apparently replaced by a "fbsr" cookie instead).
I have searched the FB documentation, and in various forums for details on how to upgrade the plugin, but unfortunately without luck.
Can anyone help with a hint or two on what steps should be performed in order to get the plugin updated?
EDIT: I think the updated version of the plugin (0.14) has been pushed the public repository. You should try grabbing that one first before reading the rest of my answer.
It looks like the plugin maintainer, Jesus Lanchas, made some updates over the last few days to enable oauth2 support. It has not been pushed to the plugin repository yet, but I was able to get it working with my project. Here's what I did:
#Install a local copy of the plugin WITHIN my project
mkdir plugins-local
cd plugins-local
git clone git://github.com/chechu/grails-facebook-graph.git
mv grails-facebook-graph facebook-graph
Update BuildConfig.groovy and tell grails where to load the plugin from. I put this line before grails.project.dependency.resolution
grails.plugin.location.'facebook-graph' = "plugins-local/facebook-graph"
Uninstall the existing facebook-graph plugin from my project
grails uninstall-plugin facebook graph
This is a temporary solution for me until the offical update hits the repo, but it allows me to make sure I'm using the same new code everywhere.
EDIT: we released our Facebook Grails SDK on GitHub :
https://github.com/benorama/facebook-grails-sdk.
Currently only tested on Grails 2.0…
Any feedback is welcome before we release it officially to Grails.org.
Indeed, it looks like Grails Facebook-graph plugin does not support OAuth2 Facebook authentication (which is required since October 1st 2011).
We have already ported the official PHP SDK V3.1.1 to ColdFusion 9 (https://github.com/affinitiz/facebook-cf-sdk).
Last month, we started to implement it as a plugin in Grails 2.0.
It is currently at an alpha stage so we have not released it yet, but it is working on our prototype.
To connect to the Facebook Graph API, it uses RestFB internally.
If you want to give it a try and give us some feedbacks, let me know, I'll sent it to you by email.

Check if facebook oauth 2.0 october 1st migration is done

I'm using facebook connect on a website, it worked well with PHP SDK 3.0.1.
Now I've downloaded and started using PHP SDK v.3.1.1 and set Encrypted Access Token to enabled. It still works without problems. Is this enough for the migration? How can I check it? I don't use the js sdk.
According to the migration guide, it looks like you have done all the steps you need for Facebook on an external website by upgrading to 3.1.1 PHP SDK and set encrypted access token.
If you were hosting a fan page or app inside Facebook you would also need an SSL certificate. And there are several code changes required if you are using the javascript SDK which you say you aren't.