【问题标题】:OAuth2 server: invalid or missing grant_type parameterOAuth2 服务器:grant_type 参数无效或缺失
【发布时间】:2015-06-01 18:05:03
【问题描述】:

我的 LAN 中启动了一个基于 NodeJS 的 OAuth2 服务器(使用 oauth2-server 模块)。我想用 Postman REST Client 测试它,但我收到了这个错误响应:

{
    "code": 400,
    "error": "invalid_request",
    "error_description": "Invalid or missing grant_type parameter"
}

这是我的请求配置:

我尝试通过 URL 发送参数,但出现错误:Method must be POST with application/x-www-form-urlencoded encoding

谢谢。

【问题讨论】:

    标签: node.js authentication oauth-2.0


    【解决方案1】:

    使用邮递员将值作为查询参数发送,但“oauth2-server”使用“req.body”将值作为正文参数检查。所以尝试将值作为正文参数发送或将 req.body 更改为req.query 在 node_modules/oauth2-server/lib/grant.js 中

    【讨论】:

    • 感谢您的回答。几周前,我将oauth2-server 更改为'oauth2orize 模块。它工作正常。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多