OAuth::问题(参数缺失)
我正在使用 OAuth 0.3.6 和 Rails 应用程序的 linkedin gem,并且我遇到了 OAuth 抛出错误并指出 OAuth::Problem (parameter_absent) 的问题。问题是它不会在每次调用时都会抛出错误,问题是我无法在本地重现该问题来测试它。
该文档说:
[parameter_absent:未收到所需参数。在这种情况下, 响应还应该包含 oauth_parameters_absent 范围。 ]
但每次生成请求的方式都相同,以获得 令牌,所以我无法理解为什么会发生这种情况。
日志
OAuth::Problem (parameter_absent):
oauth (0.3.6) lib/oauth/consumer.rb:167:in `request'
oauth (0.3.6) lib/oauth/consumer.rb:183:in `token_request'
oauth (0.3.6) lib/oauth/tokens/request_token.rb:18:in `get_access_token'
linkedin (0.1.7) lib/linked_in/client.rb:35:in `authorize_from_request'
app/controllers/users_controller.rb:413:in `linkedin_save'
我看到一些人面临这个问题,但我还没有弄清楚 解决这个问题的方法。希望对此提供一些帮助。
Im working with OAuth 0.3.6 and the linkedin gem for a Rails application and I have this issue where OAuth throws an error saying that OAuth::Problem (parameter_absent). The thing is it doesn't throw the error on every occasion its called and the problem is I am unable to reproduce the issue locally to test it.
The documentation says that :
[parameter_absent: a required parameter wasn't received. In this case,
the response SHOULD also contain an oauth_parameters_absent
parameter. ]
but the request is generated the same way each time to obtain the
tokens so I fail to understand why this happens.
Log
OAuth::Problem (parameter_absent):
oauth (0.3.6) lib/oauth/consumer.rb:167:in `request'
oauth (0.3.6) lib/oauth/consumer.rb:183:in `token_request'
oauth (0.3.6) lib/oauth/tokens/request_token.rb:18:in `get_access_token'
linkedin (0.1.7) lib/linked_in/client.rb:35:in `authorize_from_request'
app/controllers/users_controller.rb:413:in `linkedin_save'
I have seen a few people facing this issue but I am yet to figure out
a way to resolve this. Would appreciate some help on this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
parameter_absent 错误意味着您没有将所有必需的 OAuth 参数发送到端点。对于请求令牌端点,您需要确保所有这些参数都存在:
对于 accessToken 端点,需要以下参数:
The parameter_absent error means that you are not sending all of the required OAuth parameters to the endpoint. For the request token endpoint you need to insure that all of these parameters are present:
For the accessToken endpoint the following parameters are required:
我有类似的问题,想知道出了什么问题。最后才知道我忘记在提供密钥/秘密的生产服务器上设置环境变量。
不确定这是否与您的情况相同,我建议您检查环境变量(如果您正在使用它们)。
I has similar problem and was wondering what is wrong. Finally got to know that I forgot to set the Environment variable on the production server that was serving the keys/secrets.
Not sure that this is the same case with you, I would recommend you to check the env vars if you are using them.