I am trying to access the Jawbone API in my Rails app using omniauth + jawbone. I have a button that initiates the OAuth login for the user and I create a user model for this user with a token and a refresh token on my database. (It seems like the OAuth for Jawbone is working since I get the user's information).
I then query the Jawbone API with HTTParty with the user token given to me after the user logs in via Jawbone, but I get the following error:
{"meta"=>{"code"=>401, "error_detail"=>"You must be logged in to perform that action", "error_type"=>"authentication_error", "message"=>"Unauthorized"}, "data"=>{}}
The code I'm using to query the Jawbone API is:
token = current_user.token
@result = HTTParty.get('https://jawbone.com/nudge/api/v.1.0/users/@me/moves',
:headers => { "Authorization: Bearer" => "#{token}"}
)
I've been searching on the Jawbone API documentation, but can't seem to find an answer. On the Jawbone documentation it says an authentication error means "The request requires an authenticated user and no user was logged in." So does logging in via OAuth not actually log them in even though I now have a token?
Thanks for the help! I've been struggling with this.