Mixing Spring Social versions for different providers - spring-social

In the same program, I am using Spring-social facebook and Spring Social linkedIn.
I can not however make them both work on the same release environment :
Facebook works fine with the following versions flavour :
<org.springframework.social-version>1.0.3.RELEASE</org.springframework.social-version>
<org.springframework.social.facebook-version>1.0.3.RELEASE</org.springframework.social.facebook-version>
The only way I have managed to have linked in work properly and not return display "unexepcted error has occured" on the linked in site connection page is with :
<org.springframework.social-version>1.1.0.BUILD-SNAPSHOT</org.springframework.social-version>
<org.springframework.social.linkedin-version>1.0.0.BUILD-SNAPSHOT</org.springframework.social.linkedin-version>
do any of you know about a spring social version that would properly work with both?
Thanks in advance,

In my application I have used facebook and twitter combined with the version 1.1.0-BUILD-SNAPSHOT
<org.springframework.social-version>1.1.0.BUILD-SNAPSHOT</org.springframework.social-version>
<org.springframework.social.facebook-version>1.1.0.BUILD-SNAPSHOT</org.springframework.social.facebook-version>
<org.springframework.social.twitter-version>1.1.0.BUILD-SNAPSHOT</org.springframework.social.twitter-version>
I am not sure if it will work with linkedin also or not. Try it may it work.

Related

Services.AddTransient() Vs Services.AddBot()

In the latest bot samples, we can see that bot is being added to services collection as below
services.AddTransient<IBot, MyBot>();
but in older samples, we saw below approach
services.AddBot<MyBot>(options => { });
Here I am trying to understand the benefits of adding bot using AddTransient() over using AddBot().
What I know is that internally AddBot uses AddTransient only, then why use AddTransient. Referred remarks section from this link.
You can see in the source code that the AddBot methods are used for automatically adding a bot adapter to DI in addition to the bot and for configuring bot-related options like credentials and error handling. The conventions for using the Bot Builder v4 SDK were very different when those samples were made, and the bot's configuration along with its credentials were loaded from something called a bot file. The current convention for using the SDK is much easier because it takes advantage of ASP.NET Core automatically loading the app's configuration from appsettings.json. Since we're not using AddBot anymore you'll notice that the adapter is added to DI explicitly, and you can configure things like error handling and middleware either by accessing the properties and methods of the adapter directly or by deriving your own adapter class, as seen in the samples.

SonarQube Web Api Changes from 6.0 to 6.4

I was using "http://sonarserver:9000/api/resources?metrics=ncloc,bugs,vulnerabilities" to get the details of all the projects for sonar 6.0.
After upgrading to 6.4 this url does not work and I am not able to find the alternative for this under the web_api changes page.
Please let me know if anyone knows about an alternative to this.
Error: {"errors":[{"msg":"Unknown url : /api/resources"}]}
Per WebAPI documentation (embedded in your own SonarQube server, linked at the footer): api/resources/index is deprecated since 5.4 (i.e. a super long time ago).
The documentation even provides some guidance:
if you need one component with measures: api/measures/component
That will get you the measures you need for a given project. You can use other APIs to get the list of projects (e.g. api/components/search). See Web API docs for the full listing of possibilities.

Spring social and facebook api 2.4

I'm using spring-social for facebook, <version>2.0.1.RELEASE</version> and it works fine if I use the 2.3 Facebook version API.
I create a new app with the version 2.4 and it doesn’t work correctly, since FB changed the API policies:
https://developers.facebook.com/blog/post/2015/07/08/graph-api-v2.4/
Fewer default fields for faster performance:
To help improve
performance on mobile network connections, we've reduced the number of
fields that the API returns by default. You should now use the
?fields=field1,field2 syntax to declare all the fields you want the
API to return.
For example the post contains only the id and message and not from-name and from-id, so the class Post contains only this two fields.
Now to read this value we need to add “?fields=from”.
The question is, is there a way to use spring social also with the version 2.4 ?
It seems that the problem persists. So, I am using as workaround the following method to bring back the fields I need:
Facebook facebook = new FacebookTemplate(accessToken);
Post post = facebook.fetchObject(postId, Post.class, "picture, message, source, story, caption, place, description, type, from, link, icon, shares, created_time, name");

google safe browsing api url encoding (canonicalization)

In my application I am checking user-entered urls for malware by sending them to google.
To test getting a "malware found" reaction I used the url http://malware.testing.google.test/testing/malware
To my surprise this url was not marked as malware
In fiddling about I found out that when I enter a trailing slash, it does get picked up as malware.
In the documentation it says the url's need to be canonicalized.
Do any of you know of an implementation of this requirement? (preferably in c#)
Using the link ForguesR provided I have created this C# implementation.
It passes 26 out of the 33 tests from the google test suite found at: https://developers.google.com/safe-browsing/developers_guide_v3#Canonicalization
It has been deemed good enough for production since it doesnt catch the more obsure webpages.
Code: https://dotnetfiddle.net/xO9sWl
I am working on the same problem right now and the only thing I have found is a Java implementation in the jGoogleSafeBrowsing library. Unfortunately, it is stuck to v2 of the API.
Anyhow, you can have a look at the canonicalization code here. Be aware that :
this code is released as open-source under the Creative Commons NC-SA license;
this code may not pass the Google canonicalization test suit.

Twitter OAuth with MGTwitterEngine

I'm using the MGTwitterEngine to connect to twitter and I want to use OAuth with the MGTwitterEngine?
The master branch has merged OAuth and xAuth support back in.
There's a modified version of MGTwitterEngine on GitHub that is supposed to use OAuth: http://github.com/kimptoc/MGTwitterEngine-1.0.8-OAuth/
i would highly suggest using xAuth instead of OAuth as the process on the user's end doesn't at all change. i wrote a tutorial about how I got it to work on iPhone only if it helps. http://www.2bros1blog.com/2010/07/switching-from-basic-to-xauth-with-mgtwitterengine-on-iphone/
I suspect that if the MGTwitterEngine doesn't implement OAuth, it soon will, or will need support for it soon.
I'd suggest seeing if the current development version supports it, and if not -- and you have the motivation -- working on a patch for this functionality.
After having a look at STTwitter, FHSTwitterEngine and MGTwitterEngine I ended up using OAuthConsumer available through github.
My reasons for this were that I was writing an app for Mac OSX Lion in XCode with Objective-C. Most of the OAuth/Twitter code out there was either for other languages, iOS-specific or quite out of date and full of deprecated calls.
Apple's SDK 10.8 now has a social.framework (includes SLRequest) and and accounts.framework (includes ACAccount) which should be really useful for accessing FB, Twitter and some other social site I didn't recognise. Unfortunately that was no good for me working under 10.7 so I did not try those out practically. Would be interested to know anyone's experiences under 10.8.
OAuthConsumer was really straight forward to use to get through Twitter's API properly and is available in a few different languages. You do need to sort out your own JSON etc. but that's pretty straight-forward with NSJSONSerialization etc.
I've written up more detail on this on my blog Twitter OAuth Cocoa. If you need an OAuth, twitter-friendly bit of code, and the function-rich twitter engines aren't working for you then I'd recommend OAuthConsumer.

Resources