Hi all,
I am trying to figure out the spring social and OAuth authentication. In order to do this I cloned the sample project form git clone git://github.com/SpringSource/spring-social-samples.git. and I used spring-social-quickstart as I starting point.
I loded the appication context and I started creating the FacebookConnectionFactory. Everything is going well til I bumped in to the HttpServletResponse line. I don't really want to use this to build web application where users can login to their accounts by using my application. Instead I need this for the custom cms that I am building, in which the content editors would be able to push content to social sites like Facebook, LinkedIn... For example to their company's Facebook profile. This should be done by cms, automatically without further interaction required from the content editors.
Here is where I am stuck:
How can I achieve Facebook connection and the ability to post something on my own wall directly from a java console application? Is this even possible in spring social?Code:FacebookConnectionFactory connectionFactory = new FacebookConnectionFactory("clientId", "clientSecret"); OAuth2Operations oauthOperations = connectionFactory.getOAuthOperations(); OAuth2Parameters params = new OAuth2Parameters(); params.setRedirectUri("https://my-callback-url"); String authorizeUrl = oauthOperations.buildAuthorizeUrl(GrantType.IMPLICIT_GRANT, params); response.sendRedirect(authorizeUrl); // do I need this? // upon receiving the callback from the provider: AccessGrant accessGrant = new AccessGrant(accessToken); // I need this token too. Don't know how to get it. Connection<Facebook> connection = connectionFactory.createConnection(accessGrant);


Reply With Quote
.
