Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
154 lines (119 sloc) 5.4 KB
// If Client ID is provided, save it in session and try to authenticate
$fb_client_id = '';
if (isset($_POST['client_id']) && trim($_POST['client_id']) != "") {
// Register Client ID in the Session
$fb_client_id = safe(trim($_POST['client_id']));
$_SESSION['fb_client_id'] = $fb_client_id;
// Redirect to Fitbit for OAuth2
header("Location: $config_oauth_url?response_type=token&scope=$config_scope&redirect_url=$config_redirect_uri&expires_in=$config_expires_sec&client_id=$fb_client_id");
if (isset($_SESSION['fb_client_id'])) {
$fb_client_id = $_SESSION['fb_client_id'];
<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Fitbit Heart Rate Intraday Data</title>
<!-- Bootstrap -->
<link rel="stylesheet" href="" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src=""></script>
<script src=""></script>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src=""></script>
<!-- Bootstrap Script -->
<script src="" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<!-- header -->
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="./"><strong>Fitbit Heart Rate Intraday Data</strong></a>
</nav> <!-- /header -->
<div style='height:100px;'>
<div class="container">
<div class="row">
<div class="col-md-3 bg-info">
<form action="index.php" method="post">
<div class="form-group">
<label for="exampleInputEmail1">Fitbit Client ID</label>
<input type="text" class="form-control" name="client_id" id="client_id" placeholder="Enter Fitbit Client ID" value="<?php echo $fb_client_id; ?>">
<button type="submit" class="btn btn-primary">Connect with Fitbit</button>
<span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span>
<a href='' target=_blank><strong>How to get Client ID?</strong></a>
<div class="well">
<h4><span class="label label-default">Configuration Used</span></h4>
<dd><?php echo $config_scope; ?><BR><BR></dd>
<dt>Redirect URL</dt>
<dd><?php echo $config_redirect_uri; ?><BR><BR></dd>
<dt>Expires in</dt>
<dd><?php echo $config_expires_sec; ?> Seconds</dd>
</div> <!-- /well -->
</div> <!-- /col-md-3 client id form -->
<div class="col-md-9 ">
<h4>About Fitbit Intraday Heart Rate Service</h4>
Through the Fitbit App, you can view heartrate information only in 5-minute intervals. However, your tracker is capturing your heartrate every few seconds.
The service available on this website allows you to connect to the Fitbit website and get your Intraday Heart Rate Data. You can:
<li> Get detailed heartrate data from Fitbit Website
<li> View the data on a chart and export it to an image
<li> Export the data in Excel format
<P>More information on why this service was created is available at
<li> <a href=""></a>
The code is open source and you can setup a service for yourself on your server. Download it from GitHub at
<li> <a href=""></a>
<h4>Privacy Information</h4>
The heartrate information is sensitive and not something you would want to disclose to anyone. Fitbit also prevents third party developers from accessing the heartrate data. By using this service, you
<li> Setup a special developer account at Fitbit and generate your own credentials.
<li> Do not provide any identifiable information except a 'Client ID', which cannot be linked to your account, and you can also delete it from the Fitbit Website.
<li> Authenticate only through your Fitbit credentials.
<li> Save the heartrate data along with your Client ID on this website, also to enable historical data review.
<li> Have an option to setup your own service on your server without sharing data with anyone.
</div> <!-- /col-md-9 about -->
</div> <!-- /row -->
&copy; 2017 Vivek Kapoor, <a href=''></a>
</div> <!-- /container -->