ruby on rails - Authentication Error When Trying to Access Jawbone API (RoR) -


i trying access jawbone api in rails app using omniauth + jawbone. have button initiates oauth login user , create user model user token , refresh token on database. (it seems oauth jawbone working since user's information).

i query jawbone api httparty user token given me after user logs in via jawbone, following error:

{"meta"=>{"code"=>401, "error_detail"=>"you must logged in perform action", "error_type"=>"authentication_error", "message"=>"unauthorized"}, "data"=>{}} 

the code i'm using query 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 jawbone api documentation, can't seem find answer. on jawbone documentation says authentication error means "the request requires authenticated user , no user logged in." logging in via oauth not log them in though have token?

thanks help! i've been struggling this.

for struggling, it's not

{ "authorization: bearer" => "{{token}}" }

the correct header

{ "authorization" => "bearer {{token}}" }

here working code.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -