Oauth authentification to Fitbit using httr

后端 未结 2 1480
遥遥无期
遥遥无期 2020-12-16 06:07

I\'m trying to connect to the fitbit api using the httr library.

Using the examples provided, I came up with the following code:

library(httr)

key &         


        
相关标签:
2条回答
  • 2020-12-16 06:49

    The problem comes from the httr library, that uses curlEscape for encoding paramaters while the OAuth 1.0 specifications requires percent encoding (see this page).

    Replacing calls to curlEscape with curlPercentEncode solves the issue!

    many thanks to @mark-s for his help.

    0 讨论(0)
  • 2020-12-16 07:05

    The only thing I notice is that your call to get the signature is slightly different than the httr examples. The httr examples are:

    sig <- sign_oauth1.0(myapp, token$oauth_token, token$oauth_token_secret)
    

    While your code is:

    sig <- sign_oauth1.0(fbr,
        token=token$oauth_token,
        token_secret=token$oauth_token_secret
    )
    

    Do you need the "token=" and "token_secret=" in your code?

    0 讨论(0)
提交回复
热议问题