nIx..
nIx..

Reputation: 370

OAuth issue in Grails

I am tyring to configure login using twitter in my grails application getting this stack trace when i do run-app

Server running. Browse to http://localhost:8080/TestOAuth
Error initializing the application: Error creating bean with name 'uk.co.desirableobjects.oauth.scribe.OauthController': Initialization of bean failed;<br/>
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'oauthService': Invocation of init method failed; nested exception is uk.co.desirableobjects.oauth.scribe.exception.InvalidOauthProviderException: [:] is not a Class <br/>

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'uk.co.desirableobjects.oauth.scribe.OauthController': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'oauthService': Invocation of init method failed; nested exception is uk.co.desirableobjects.oauth.scribe.exception.InvalidOauthProviderException: [:] is not a Class
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722) <br/>

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'oauthService': Invocation of init method failed; nested exception is uk.co.desirableobjects.oauth.scribe.exception.InvalidOauthProviderException: [:] is not a Class
... 5 more <br/>
Caused by: uk.co.desirableobjects.oauth.scribe.exception.InvalidOauthProviderException: [:] is not a Class
at uk.co.desirableobjects.oauth.scribe.OauthService.afterPropertiesSet(OauthService.groovy:48)
... 5 more
| Error Forked Grails VM exited with error

this is what i configured for twitter

oauth {
    providers {
        twitter {
            api = 'TwitterApi'
            key = 'i have my key here'
            secret = 'i have my secrete key here'
            successUri = '/success.gsp'
            failureUri = '/fail.gsp'
        }
    }
    debug = true
}

Upvotes: 1

Views: 754

Answers (1)

dmahapatro
dmahapatro

Reputation: 50245

The provider API is a class (from scribe API) instead of String, which has to be referred in the config.

import org.scribe.builder.api.TwitterApi

oauth {
    providers {
        twitter {
            api = TwitterApi
            key = 'i have my key here'
            secret = 'i have my secrete key here'
            successUri = '/success.gsp'
            failureUri = '/fail.gsp'
        }
    }
    debug = true
}

Upvotes: 3

Related Questions