首页 文章

调用FITBIT rest API时出现无效签名错误

提问于
浏览
1

我已在FITBIT注册 . 我正在向使用消费者密钥的fitbit api(POST /oauth/request_token )发出请求 . 我已经提到https://wiki.fitbit.com/display/API/OAuth+Authentication+in+the+Fitbit+API

My request is: POST / request_token HTTP / 1.1主机:oauth授权:OAuth realm = "https:/api.fitbit.com/oauth/request_token",oauth_consumer_key = "XXXXXXXXXXXX",oauth_signature_method = "HMAC-SHA1",oauth_timestamp = "1399958922",oauth_nonce = "H8xxW0",oauth_version = "1.0",oauth_signature = "80M1tag6%2FYk2JV%2FQdQ%2BucxxDrLA%3D" Cache-Control:no-cache

I am getting invalid signature error with below json object:

{
    "errors": [
        {
            "errorType": "oauth",
            "fieldName": "oauth_signature",
            "message": "Invalid signature: 80M1tag6/Yk2JV/QdQ+ucxxDrLA="
        }
    ],
    "success": false }

我们有消费者密钥和消费者密钥 . 在这个阶段没有令牌秘密 . 请给我一个解决方案,让这个API工作 .

谢谢,Kalyan

1 回答

  • 0

    与WestDiscGolf提到的一样,您需要确保您的回调URL与您正在编写的应用程序中的回调URL匹配 . 通常,当您注册开发人员帐户以访问API时,他们会要求提供回调URL,并且回调URL必须与您在请求访问令牌时放入的内容相匹配 .

    如果你're getting an invalid signature error, though, then the callback URL probably isn' t问题 . 您需要确保签名与API文档中指定的完全匹配 . 签名可能很棘手,并且有许多库可以帮助解决这个问题 . 我主要使用Java,而对于Java,Scribe库很棒(https://github.com/fernandezpablo85/scribe-java) .

相关问题