agorapulse / grails-facebook-sdk

Facebook SDK Grails Plugin
http://agorapulse.github.com/grails-facebook-sdk/guide
30 stars 13 forks source link

Facebook Login #79

Closed Qsaws closed 7 years ago

Qsaws commented 7 years ago

I wanted to put a facebook log in button on one of my view then check if the User had authorized my app and is authenticated, then extract his email adress from the facebookContext as shown in the documentation.

But i can't seem to be able to put a facebook:loginLink in my views (says it's not allowed here) or use facebookContext in my controllers (i don't know what to import to be able to use it).

I've added the plugin to my dependencies and my facebook app info in the application.yml as explained in the documentation.

I'm kinda new to groovy so sorry if my questions seem dumb but i've ran out of ideas.

benorama commented 7 years ago

Have you checked https://github.com/agorapulse/grails-facebook-sdk-demo ? Default develop branch is still on Grails2.

For Grails3, check grails3 branch: https://github.com/agorapulse/grails-facebook-sdk-demo/tree/grails3

Qsaws commented 7 years ago

I tried but whenever i create a FacebookContext in one of my controller i get

URI /user/register Class groovy.lang.MissingMethodException Message Error creating bean with name 'myapp.UserController': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'facebookContext': Invocation of init method failed; nested exception is groovy.lang.MissingMethodException: No signature of method: org.grails.config.NavigableMap.toLong() is applicable for argument types: () values: [] Possible solutions: clone(), toString(), toString(), toString(), count(groovy.lang.Closure), notify() Caused by No signature of method: org.grails.config.NavigableMap.toLong() is applicable for argument types: () values: [] Possible solutions: clone(), toString(), toString(), toString(), count(groovy.lang.Closure), notify()

Not really sure how to fix this error.

benorama commented 7 years ago

Hi,

It finally took the time to upgrade the demo apps to Grails 3.2.3 and Facebook SDK 2.7.1. You might give it a try: https://github.com/agorapulse/grails-facebook-sdk-demo/tree/grails3