使用Google帐户和OAuth插件登录Grails应用程序

时间:2015-07-07 06:52:32

标签: grails oauth-2.0

我正在尝试创建一个登录页面,用户可以使用他们的Google帐户登录。我正在使用grail的'oauth:2.6.1'插件来实现此目的。 我在谷歌注册了一个应用程序,并获得了客户端ID和秘密,但我无法在我的config.groovy中使用它。它引发了以下异常:

[http-bio-8080-exec-10] ERROR errors.GrailsExceptionResolver  - OAuthException occurred when processing request: [GET]    /MyApp/oauth/google/authenticate - parameters:
redirectUrl: 
Response body is incorrect. Can't extract token and secret from this: 'Consumer is not registered: 553489692142-6l3c1tk0l0rtc7dgebeijbh5jtcv4tor.apps.googleusercontent.com
'. Stacktrace follows:
Message: Response body is incorrect. Can't extract token and secret from this: 'Consumer is not registered: 553489692142-6l3c1tk0l0rtc7dgebeijbh5jtcv4tor.apps.googleusercontent.com
'
    Line | Method
->>   41 | extract         in org.scribe.extractors.TokenExtractorImpl
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|     27 | extract         in     ''
|     64 | getRequestToken in org.scribe.oauth.OAuth10aServiceImpl
|     40 | getRequestToken in     ''
|     45 | getRequestToken in     ''
|     78 | authenticate    in    uk.co.desirableobjects.oauth.scribe.OauthController
|    198 | doFilter . . .  in grails.plugin.cache.web.filter.PageFragmentCachingFilter
|     63 | doFilter        in grails.plugin.cache.web.filter.AbstractFilter
|   1145 | runWorker . . . in java.util.concurrent.ThreadPoolExecutor
|    615 | run             in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run . . . . . . in java.lang.Thread

我的grails版本是2.5。请帮我解决这个问题。

1 个答案:

答案 0 :(得分:0)

似乎您的google api凭据不好。在google开发者控制台中检查您的密钥/密码。