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

标签 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。请帮我解决这个问题。

最佳答案

您的 google api 凭据似乎很糟糕。在谷歌开发者控制台中检查你的 key / secret 。

关于grails - 使用 Google 帐户和 OAuth 插件登录 Grails 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31261693/

相关文章:

grails - 无法运行Grails应用程序

image - 使用Google图片图表将图片导出到Excel?

Java - Reader 无法解析

android - 如何授予对关联/辅助 Google 帐户的访问权限

grails - 通过键访问存储在映射中的配置变量

grails - Grails spring-security-shiro:在gsp中使用Apache Shiro主题-从shiro迁移到spring-security-shiro

grails - 将dateCreated字段添加到现有对象

oauth-2.0 - 客户端凭据流的访问 token 中的 invalid_scope 错误

java - 如何使用 OAuth2 向 Mendeley 进行身份验证

java - 函数 isAssignableFrom 在服务器启动期间返回 false