splix/grails-spring-security-facebook — Issue #5: Acessing user Information
Author: joergrech
Created: 2012-01-24 07:45:12+00:00
State: open

Hi,
I still have a problem accessing user information from a facebook user. It looks like the user is identified ( returns a number) but no other information such as email is available!

Furthermore, if I call facebook.userOperations().userProfile I get the following Exception:

org.springframework.social.MissingAuthorizationException: Authorization is required for the operation, but the API binding was created without authorization.
at org.springframework.social.facebook.api.impl.FacebookErrorHandler.handleFacebookError(FacebookErrorHandler.java:95)
at org.springframework.social.facebook.api.impl.FacebookErrorHandler.handleError(FacebookErrorHandler.java:60)
at org.springframework.web.client.RestTemplate.handleResponseError(RestTemplate.java:486)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:443)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:415)
at org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:213)
at org.springframework.social.facebook.api.impl.FacebookTemplate.fetchObject(FacebookTemplate.java:160)
at org.springframework.social.facebook.api.impl.UserTemplate.getUserProfile(UserTemplate.java:50)
at org.springframework.social.facebook.api.impl.UserTemplate.getUserProfile(UserTemplate.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:1602)
at groovy.lang.ExpandoMetaClass.getProperty(ExpandoMetaClass.java:1099)
at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:3311)
at groovy.lang.ExpandoMetaClass.getProperty(ExpandoMetaClass.java:1111)
at org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:161)
at org.codehaus.groovy.runtime.callsite.PojoMetaClassGetPropertySite.getProperty(PojoMetaClassGetPropertySite.java:33)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:235)
at FacebookAuthDaoImpl.create(FacebookAuthDaoImpl.groovy:59)
...

From Googling a little bit around it seems that the FacebookTemplate() is returned without any authorization credentials.

Any ideas what I can do?

Many thanks in advance,
Joerg