linkedin-j & Access to posting shares denied
<1 min read
This morning I noticed that my blog wasn't able to share on Linkedin anymore. I use the linkedin-j library to automatically share new blog posts on Linkedin. I rightfully assumed that my OAuth access token had expired. Upon resetting the token, I got the following error:
Access to posting shares denied
After a bit of research I was able to ascertain that the linkedin-j library was not requesting write access permission, which apparently is now required.
If was able to fix the problem by adding the following code right before the token request:
final Field field = LinkedInApiUrls.class.getField("LINKED_IN_OAUTH_REQUEST_TOKEN_URL");
field.setAccessible(true);
final Field modifiersField = java.lang.reflect.Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
field.set(null, LinkedInApiUrls.LINKED_IN_OAUTH_REQUEST_TOKEN_URL + "?scope=rw_nus+r_basicprofile");
You gotta love the reflection API.
I can't really take the credit for the solution, I found it on stackoverflow.
Twits du Jour (Dec 19)
<1 min read
- I'm at @WinCoFoods (Everett, WA) 4sq.com/18VKMOS #
- I'm at Bob's Burgers & Brew - @bobsburgerbrew (Everett, WA) 4sq.com/18VBaDG #
- Hackers Steal Credit Card Data From Up to 40 Million Target Customers thauv.in/19ADMe1 #
Twits du Jour (Dec 17)
<1 min read
- I'm at @TheUPSStore (Everett, WA) 4sq.com/1hiwqxw #
- I'm at @DollarTree (Lynnwood, WA) 4sq.com/1keXBLP #
- I'm at CC Teriyaki (Everett, WA) 4sq.com/JE4t82 #