Search code examples
springfacebookauthenticationspring-social

Spring Facebook Template


I am trying to develop an Android application. It requires Facebook auth to be used. I am using Spring as a backend. There is this nice Spring extension called Spring Social but I am having trouble to use it in the way I want it.

I authenticate in the Android device and send it to my backend. Then do this in the controller:

Facebook facebook = new FacebookTemplate(authToken);
String facebookId = facebook.userOperations().getUserProfile().getId();

I am getting the error:

org.springframework.social.MissingAuthorizationException: Authorization is required for the operation, but the API binding was created without authorization.

I think Spring is doing this GET call:

https://graph.facebook.com/me

when it should do something like:

https://graph.facebook.com/me?access_token=ACCESS_TOKEN

I have tried this with a valid token and nothing. Am I doing something wrong?


Solution

  • In case someone gets the same error, check the dependencies in Maven, I had them wrong