php - oauth 401 unauthorized error for heroku app fitbit -
i've got heroku app , running auth0 way of logging in via oauth... have code more or less same fitbit api php tutorial - "completeauthorization.php". looks bit like:
$oauth = new oauth($conskey, $conssec, oauth_sig_method_hmacsha1,oauth_auth_type_authorization); $oauth->enabledebug(); } catch( oauthexception $e ) { print_r($e); } echo 'done new oauth'; $oauth->settoken($_session['access_token'], $_session['access_token_secret']); echo 'done set token'; // fitbit api call (get activities specified date) //http://api.fitbit.com/1/user/28c9gg/activities/date/2013-12-01.xml $apicall2 = 'http://api.fitbit.com/1/user/'.$_session['userid'].'/activities/date/2014-02-25.xml'; echo $apicall2; // performing api call $oauth->fetch($apicall2); //$oauth->fetch($apicall); var_dump($oauth->getlastresponse());
i user id, , session secret , token etc. auth0 response index.php page, save them in session keep them on activities page.
but when go page after log in auth0, error: http://api.fitbit.com/1/user/28c9gg/activities/date/2014-02-25.xml fatal error: uncaught exception 'oauthexception' message 'invalid auth/bad request (got 401, expected http/1.1 20x or redirect)'
i able far on webserver has pecl oauth extension installed, heroku not , have no idea how on heroku, ideas on or why above error?
here example might useful:
https://github.com/auth0/auth0-php/tree/master/examples/fitbit
in particular @ callback.php
there call fitbit api
matias
Comments
Post a Comment