The next release of NixMash Spring will add OAUTH authorization and automated local site account creation. Since NixMash Spring is a Spring Boot application, we’re going to jumpstart our OAUTH work with the Spring Boot Social Showcase on GitHub.
Spring Social Showcase for Spring Boot focuses on performing services on Facebook, Twitter and LinkedIn with a manual step of creating a local account from the OAUTH account. In NixMash Spring we’ll focus less on accessing site services like feeds or followers and more on seamlessly integrating OAUTH and local site accounts.
Like other Guides, Tutorials and Quickstarts from the Spring Framework Team, Spring Social Showcase for Spring Boot is a valuable learning tool. After spending some time with it, and since others following NixMash Spring might want to likewise investigate the Showcase, I wanted to share some tips for getting up and running with minimal pain.
We’ll be using Twitter and Facebook OAUTH in NixMash Spring and ignoring LinkedIn, so you won’t see LinkedIn in the following screenshots. For those who are unfamiliar with the Spring Social Showcase, here’s the Home Page.
Here’s the OAUTH and local account step I mentioned. It works great but we’ll be adding logic to automate this step.
Here’s an example of the Social Showcase accessing OAUTH Provider services, in this case my Facebook profile. (I restrict public access to my email address, so it is not available or displayed in the profile, something we’ll no doubt want to address in NixMash Spring when creating the local site account.)
Pretty cool so far, eh? Now for those tips for getting the Showcase up and running.
App IDs and Secret Keys in application.properties
This took a while to get past, since this was my first dance with Spring Social. (Sounds redundant, doesn’t it?) My FacebookController Bean wasn’t being created as you can see below.
It turns out that the properties in the application.properties file needed updating. The original entries are commented out.
Facebook API Changes
One of the downsides of using OAUTH or any Third-party Service is that they can change their APIs and crush your code. Facebook made such changes to their API, one of which being the removal of a UserProfile address property. This produces an ugly runtime in the Spring Social Showcase app. Fortunately the Spring Framework Development Team is all over it and fixed the issue in the latest v2.0.3 Spring Facebook libraries.
The original Gradle dependencies followed by the updated dependencies that will get you past the API incompatibility are shown below.
If I discover other tips that will save you time firing-up the Spring Boot Social Showcase I’ll report back. Otherwise, next time we’ll hopefully start getting into the meat of the Spring Social module in our…Journey into OAUTH.