Grails OAuth2 登录密码凭据授予 returns invalid_client

Grails OAuth2 signin Password Credentials Grant returns invalid_client

我正在开发一个受 OAuth2 身份验证保护的基本 grails 应用 -- code here。这只不过是 spring-security 和 spring-security-oauth 插件对于入门应用程序的作用。在我的 bootstrap 中(根据入门):

Role roleUser = new Role(authority: 'ROLE_USER').save(flush: true)

User user = new User(
        username: 'user',
        password: 'password',
        enabled: true,
        accountExpired: false,
        accountLocked: false,
        passwordExpired: false
).save(flush: true)

UserRole.create(user, roleUser, true)

new Client(
        clientId: 'my-client',
        authorizedGrantTypes: ['authorization_code', 'refresh_token', 'implicit', 'password', 'client_credentials'],
        authorities: ['ROLE_CLIENT'],
        scopes: ['read', 'write'],
            redirectUris: ['http://example.com']
).save(flush: true)

我试图按照 documentation 中列出的示例流程来理解 OAuth 登录流程。

每当我尝试通过此请求使用 "Resource Owner Password Credentials Grant" 进行身份验证时:

$ curl -X POST -d "client_id=my-client" \
    -d "grant_type=password" -d "username=user" \
    -d "password=password" -d "scope=read" \
     http://localhost:9090/grails-oauth-service/oauth/token

我收到以下消息:

{"error":"invalid_client","error_description":"Bad client credentials"}

我做错了什么?我(或我的客户)如何正确地进行一次调用以对服务进行身份验证?

睡眠可以解决问题,真是太神奇了。进来准备重新创建整个设置,我发现我按照入门指南搞砸了一些东西。

从插件下载页面开始查看最新的插件版本:

spring-security-oauth2-provider:2.0-RC5

并根据我的应用程序检查了由于某种原因

spring-security-oauth2-provider:2.0-RC3

我升级了插件,重新运行 s2-init-oauth2-provider 脚本,将其启动,上面的 curl post 成功了!浏览 RC-5 的 change log 我看到

Resolve minor problems affecting stateless access of OAuth 2.0 resources

所以基本上我 运行 遇到了那个版本的 oauth 提供程序插件的错误。欢乐时光。