Closed farkaskid closed 7 years ago
Hi,
I've not personally tried this plugin with Grails 3, it was very kindly updated to Grails 3 by another user. However the error looks fairly understandable to me - and that is that the scribe
library is missing.
I'm not sure how Grails 3 handles transient dependencies, but scribe is a dependency of the plugin and should therefore be included.
If you want to try manually including the correct scribe version in your build.gradle
and trying again, that might help?
Thankyou for the reply. Now the thing is it is not an issue related to plugin but an grails specific issue. Here is what is found, this was in the list of changes while migrating from grails 3.1 to above.
application.groovy Changes An improvement was added to make groovy configuration behave like yml configuration when it comes to the CLI. Previously, configuration values in application.groovy were not available to commands like grails create-controller. A side effect of this change causes an exception when those commands are executed if the configuration relies on classes in the runtime.
Error occurred running Grails CLI: startup failed:
script14738267015581837265078.groovy: 13: unable to resolve class com.foo.Bar
The solution is to create a separate file called runtime.groovy in grails-app/conf. That file will not be parsed by the CLI and will only be included at runtime.
Now i realise that the same thing is happening to me. So i moved this segment to runtime.groovy
import org.scribe.builder.api.FacebookApi
oauth {
providers {
facebook {
api = FacebookApi
key = 'my key'
secret = 'my secret'
successUri = "${application.baseUrl}/hello/oauthFb"
callback = "${application.baseUrl}/oauth/facebook/callback"
}
}
}
So there is no error and it compiles but as plugin docs mention to put this code segment in application.groovy, I think plugin does'nt work in this situation because when i use the
<oauth:connect provider="facebook" id="facebook-connect-link">Connect to Facebook</oauth:connect>
the link that renders have no redirectUrl
<a href="/oauth/facebook/authenticate?redirectUrl=" provider="facebook">Connect to Facebook</a>
so i get an exception again. What could be the reason for an empty RedirectUrl ?
exception
URI:/oauth/facebook/authenticate
Class:java.lang.IllegalArgumentException
Message:null
Caused by:Must provide a valid url as callback. Facebook does not support OOB
This relates to another issue #57 and should be fixed by #58 . I'll review the full changelist from #58 as soon as I can and release a new version.
I've released v4.0.0 which should solve the issue you are having.
Hi, I've followed as you said in the docs but when i import the FacebookAPI in the application.groovy
I get this
here is the dependencies part of build.gradle
I've also tried with TwitterAPI, same issue. Also posted on Stack. I know it is class resolution error so I tried to include scribe classes manually with the scribe.jar but still nothing happens. Am i missing something obvious?. application.yml