I'm trying to create a Google Login option in a Grails project. I'm new to Grails and am using version 2.4.4 as this was the latest at the time of installing. After much searching of the Grails Plugins I've added the last 4 lines to my BuildConfig.groovy file:
plugins {
// plugins for the build system only
build ":tomcat:7.0.55"
// plugins for the compile step
compile ":scaffolding:2.1.2"
compile ':cache:1.1.8'
compile ":asset-pipeline:1.9.9"
// plugins needed at runtime but not for compilation
runtime ":hibernate4:4.3.6.1" // or ":hibernate:3.6.10.18"
runtime ":database-migration:1.4.0"
runtime ":jquery:1.11.1"
// Uncomment these to enable additional asset-pipeline capabilities
//compile ":sass-asset-pipeline:1.9.0"
//compile ":less-asset-pipeline:1.10.0"
//compile ":coffee-asset-pipeline:1.8.0"
//compile ":handlebars-asset-pipeline:1.3.0.3"
// added these...
compile ':spring-security-core:2.0-RC4'
compile ':spring-security-oauth:2.1.0-RC4'
compile ':spring-security-oauth-google:0.3.1'
}
And I've added the following block to my Config.groovy file:
oauth {
providers {
google {
api = org.grails.plugin.springsecurity.oauth.GoogleApi20
key = app id
secret = secret key
successUri = '/oauth/google/success'
failureUri = '/oauth/google/error'
callback = "${baseURL}/oauth/google/callback"
scope = 'https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email'
}
debug = true
connectTimeout = 5000
receiveTimeout = 5000
}
I've also ran "grails s2-init-oauth" and created an "OAuthID" class. When I run my application, however, I get a error which says...
Error creating bean with name 'oauthService': Invocation of init method failed; nested exception is groovy.lang.MissingPropertyException: No such property: key for class: java.lang.Boolean
Has anyone encountered this problem and can suggest a fix? Even an explanation of what is causing the error message in the first place would help me at this point?
I have also created login using Google. For that I have use Oauth Plugin.
For that, in BuildConfig.groovy I have added
compile ":oauth:2.1.0"
In Config.groovy,
oauth {
providers {
google {
api = org.scribe.builder.api.GoogleApi
key = '583594517530-72ipieehn58c5160rvgdsodjgiifoedn.apps.googleusercontent.com'
secret = 'pBtTg2j_EfanwNhuuAIDWW48'
scope ='https://www.googleapis.com/auth/userinfo.email'
callback = "http://localhost:8080/googleAuthen/oauth/google/callback"
successUri = "http://localhost:8080/googleAuthen/oauthCallBack/google"
}
}
}
You can see full code in this github repo.
The documentation for the Oauth plugin is here.