ABCDEFGHIJKLMN
1
IDTitleBodyAcceptedAnswerIdHasAcceptedAnswerCreationDateScoreViewCountOwnerUserIdOwnerDisplayNameTagsAnswerCountCommentCountFavoriteCount
2
8137052How to make a dummy call to check if tokens are valid?<p>I made a function to know if a person is connected to an API. After creating a new token
I want to know if the tokens are valid or not. I'm kind of stuck here. How can you make that dummy call and check the validity of the tokens?</p>

<pre><code>private bool IsConnectedToFitbit()
{
var access = StaminaFacade.GetBenefiaryAccess(this.Contact.EmployeeId, ProviderCode.Fitbit);

if (string.IsNullOrEmpty(access.AuthorizationKey1) || string.IsNullOrEmpty(access.AuthorizationKey2))
return false;
else
{
var tokens = new OAuthTokens
{
ConsumerKey = PortalSettings.FitbitAppId,
ConsumerSecret = PortalSettings.FitbitAppSecret,
AccessToken = access.AuthorizationKey1,
AccessTokenSecret = access.AuthorizationKey2
};

//TODO: make a dummy call to fitbit to check if tokens are valid

return true;
</code></pre>
False2011-11-15 13:27:5703981047616<c#><token><fitbit>04
3
11465245How can I use FitBit API for website development?<p>I am trying to use the FitBit API at website development, I want to make a website from scratch but I'm unable to do so.</p>

<p>I've followed the steps described <a href="https://wiki.fitbit.com/display/API/Fitbit+API" rel="nofollow">here</a> and I have created a VB.NET Website in Visual Studio based on the ideas described <a href="https://wiki.fitbit.com/display/API/API+.NET+Client" rel="nofollow">here</a>. I have downloaded the OauthNET-Release library, referenced the DLLs into my project and my web.config looks like this:</p>

<pre><code>&lt;?xml version="1.0"?&gt;

&lt;!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
--&gt;

&lt;!--&lt;configuration&gt;
&lt;connectionStrings&gt;
&lt;add name="ApplicationServices"
connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true"
providerName="System.Data.SqlClient" /&gt;
&lt;/connectionStrings&gt;

&lt;system.web&gt;
&lt;compilation debug="false" strict="false" explicit="true" targetFramework="4.0" /&gt;

&lt;authentication mode="Forms"&gt;
&lt;forms loginUrl="~/Account/Login.aspx" timeout="2880" /&gt;
&lt;/authentication&gt;

&lt;membership&gt;
&lt;providers&gt;
&lt;clear/&gt;
&lt;add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices"
enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false"
maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"
applicationName="/" /&gt;
&lt;/providers&gt;
&lt;/membership&gt;

&lt;profile&gt;
&lt;providers&gt;
&lt;clear/&gt;
&lt;add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/&gt;
&lt;/providers&gt;
&lt;/profile&gt;

&lt;roleManager enabled="false"&gt;
&lt;providers&gt;
&lt;clear/&gt;
&lt;add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" /&gt;
&lt;add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" /&gt;
&lt;/providers&gt;
&lt;/roleManager&gt;

&lt;/system.web&gt;

&lt;system.webServer&gt;
&lt;modules runAllManagedModulesForAllRequests="true"/&gt;
&lt;/system.webServer&gt;
&lt;/configuration&gt;--&gt;

&lt;configuration&gt;
&lt;configSections&gt;
&lt;section name="foo" type="bar"/&gt;
&lt;!-- lines omitted --&gt;
&lt;/configSections&gt;
&lt;oauth.net.components&gt;
&lt;!-- Components --&gt;
&lt;components&gt;
&lt;!-- Signing provider for HMAC-SHA1 --&gt;
&lt;component service="OAuth.Net.Common.ISigningProvider, OAuth.Net.Common" lifestyle="thread"/&gt;
&lt;!-- Nonce provider --&gt;
&lt;component service="OAuth.Net.Common.INonceProvider, OAuth.Net.Common"/&gt;
&lt;!-- State store --&gt;
&lt;component service="OAuth.Net.Consumer.IRequestStateStore, OAuth.Net.Consumer"/&gt;
&lt;/components&gt;
&lt;/oauth.net.components&gt;
&lt;!-- lines omitted --&gt;
&lt;/configuration&gt;
</code></pre>

<p>I've tried to build the website, but it wasn't successful and I received this message:</p>

<pre><code>Error 11 Unrecognized configuration section oauth.net.components.
</code></pre>

<p>My question is: What should I do to make this work? Thank you in advance. </p>
11466534True2012-07-13 06:28:2711238436560<asp.net><oauth><fitbit>10
4
11587881ROAuth R and FitBit API Error: No Authorization header provided<p>Using R and the ROAuth package by Jeff Gentry to try and pull data off of fitbit and the Authentication doesn't seem to work. Code as follows:</p>

<pre><code>apiURL = 'api.fitbit.com/'

credentials = OAuthFactory$new(consumerKey=key,
consumerSecret=secret,
requestURL=tokenURL,
accessURL=accessTokenURL,
authURL=authorizeURL
)
</code></pre>

<p>and then I run the handshake:</p>

<pre><code>&gt; credentials$handshake()
To enable the connection, please direct your web browser to:
http://www.fitbit.com/oauth/authorize?oauth_token=036afa88a832bfffc72af485e38c1572
When complete, record the PIN given to you and provide it here:
</code></pre>

<p>Complete the authorization and paste in the oauth_verifier token, resulting in a proper looking set of credentials.</p>

<p>Finally I try to get the profile data that I'm after:</p>

<pre><code>rawToChar(credentials$OAuthRequest(paste(apiURL,"1/user/userID/profile.json", sep="", collapse=''), "GET"))
</code></pre>

<p>And I get this in response:</p>

<pre><code>[1] "{\"errors\":[{\"errorType\":\"oauth\",\"fieldName\":\"n/a\",\"message\":\"No
Authorization header provided in the request. Each call to Fitbit API should be OAuth
signed\"}]}"
</code></pre>
11656981True2012-07-20 22:45:39314241313710<r><oauth><fitbit>201
5
12212958Oauth authentification to Fitbit using httr<p>I'm trying to connect to the fitbit api using the <a href="https://github.com/hadley/httr/" rel="nofollow">httr library</a>.</p>

<p>Using the examples provided, I came up with the following code:</p>

<pre><code>library(httr)

key &lt;- '&lt;edited&gt;'
secret &lt;- '&lt;edited&gt;'
tokenURL &lt;- 'http://api.fitbit.com/oauth/request_token'
accessTokenURL &lt;- 'http://api.fitbit.com/oauth/access_token'
authorizeURL &lt;- 'https://www.fitbit.com/oauth/authorize'

fbr &lt;- oauth_app('fitbitR',key,secret)
fitbit &lt;- oauth_endpoint(tokenURL,authorizeURL,accessTokenURL)

token &lt;- oauth1.0_token(fitbit,fbr)
sig &lt;- sign_oauth1.0(fbr,
token=token$oauth_token,
token_secret=token$oauth_token_secret
)
</code></pre>

<p>I get the <em>Authentication complete.</em> message from httr, but trying to access the api then throws an error message</p>

<pre><code>GET("http://api.fitbit.com/1/user/-/activities/date/2012-08-29.json", sig)
Response [http://api.fitbit.com/1/user/-/activities/date/2012-08-29.json]
Status: 401
Content-type: application/x-www-form-urlencoded;charset=UTF-8
{"errors":[{"errorType":"oauth","fieldName":"oauth_access_token","message":"Invalid signature or token '&lt;edited&gt;' or token '&lt;edited&gt;'"}]}
</code></pre>

<p>Any clue about what the problem might be?</p>
12244819True2012-08-31 09:53:2252744142892<r><oauth><fitbit><httr>204
6
12637073I am getting error while trying to get profile details from Fitbit using api. What is the reason?<p>Error is,</p>

<pre><code>stdClass Object
(
[errors] =&gt; Array
(
[0] =&gt; stdClass Object
(
[errorType] =&gt; oauth
[fieldName] =&gt; n/a
[message] =&gt; No Authorization header provided in the request. Each call to Fitbit API should be OAuth signed
)

)

)
</code></pre>

<p>I am using Oauth library. I have already got user token.</p>

<pre><code>http://api.fitbit.com/1/user/23Q/profile.json?oauth_consumer_key=425e1234b8823e26485aa6&amp;oauth_nonce=31f991c9b3e068c14adceddd9b862c0a&amp;oauth_signature=R5oi4dHA6ztIIpdKheahYOy%2FeMQ%3D&amp;oauth_signature_method=HMAC-SHA1&amp;oauth_timestamp=1348821623&amp;oauth_token=3405b4918d5d96a7b78885a98&amp;oauth_version=1.0
</code></pre>

<p>I tried this... </p>

<p>$url = <a href="http://api.fitbit.com/1/user/23Q2SP/profile.json" rel="nofollow">http://api.fitbit.com/1/user/23Q2SP/profile.json</a>; </p>

<p>$header = array();<br>
$header[] = "Authorization: OAuth 3405b496578885a98";</p>

<pre><code>$header[] = "Accept: ";

$header[] = "Cache-Control: no-cache";
$header[] = "Connection: keep-alive";
$header[] = "Keep-Alive: 300";
$header[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7";
$header[] = "Accept-Language: en_US";
$header[] = "Pragma: no-cache";
$this-&gt;http_info = array();
$ci = curl_init();
/* Curl settings */
curl_setopt($ci, CURLOPT_USERAGENT, $this-&gt;useragent);
curl_setopt($ci, CURLOPT_CONNECTTIMEOUT, $this-&gt;connecttimeout);
curl_setopt($ci, CURLOPT_TIMEOUT, $this-&gt;timeout);
curl_setopt($ci, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ci, CURLOPT_HTTPHEADER, $header);
curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ci, CURLOPT_HEADERFUNCTION, array($this, 'getHeader'));
curl_setopt($ci, CURLOPT_HEADER, FALSE);

curl_setopt($ci, CURLOPT_URL, $url);
$response = curl_exec($ci);
</code></pre>

<p>BUT THE SAME ERROR
{"errors":[{"errorType":"oauth","fieldName":"n/a","message":"No Authorization header provided in the request. Each call to Fitbit API should be OAuth signed"}]}</p>
False2012-09-28 09:16:47118331414234<php><oauth><http-headers><fitbit>20
7
14036210IOS HTTP Request Example<p>I am trying make a call to the fitbit API.
I am unsure how to input the HTTP request shown below into my Objective C code in order to make this call and handle the response. </p>

<pre><code>POST /oauth/request_token HTTP/1.1
Host: api.fitbit.com
Authorization: OAuth oauth_consumer_key="fitbit-example-client-application",
oauth_signature_method="HMAC-SHA1",
oauth_timestamp="1270248082",
oauth_nonce="161822064",
oauth_callback="http%3A%2F%2Fexample.fitbit.com%2Fapp%2FcompleteAuthorization",
oauth_signature="Omf%2Bls2gn%2BDlghq245LRIyfMdd8%3D"
oauth_version="1.0"
</code></pre>

<p>A simple example would be helpful. Thank you. </p>
14065514True2012-12-26 05:09:12520641928973<ios6><http-headers><fitbit>40
8
14686906Fitbit account Integration in Android<p>I am working on an application which is related to medical science, where I have to implement FitBit device with my application.</p>

<p>I am following FitBit developer tools for it but I am unable to integrate it and if I am doing it manually without FitBit library I am unable to back on my application after authentication.</p>

<p>My code is below-</p>

<pre><code> private void login() {

try {

HttpResponse response = null;
HttpParams httpParameters = new BasicHttpParams();
HttpConnectionParams.setConnectionTimeout(httpParameters, 20000);
HttpConnectionParams.setSoTimeout(httpParameters, 20000);
HttpClient client = new DefaultHttpClient(httpParameters);

HttpGet request = new HttpGet(
"http://api.fitbit.com/oauth/request_token?oauth_consumer_key=7af733f021f649bcac32f6f7a4fe2e9a&amp;oauth_signature_method=HMAC-SHA1&amp;oauth_timestamp=1358921319&amp;oauth_nonce=456236281&amp;oauth_callback=http://www.androidhub4you.com/&amp;oauth_version=1.0&amp;oauth_token=5cefb18d2a80073520211f03f8d75321&amp;oauth_signature=QdVUzMvT6tveGyoPu%2BEevzvo07s%3D");
response = client.execute(request);

BufferedReader rd = new BufferedReader(new InputStreamReader(
response.getEntity().getContent()));

String webServiceInfo = "";
while ((webServiceInfo = rd.readLine()) != null) {
Log.e("****Step 1***", "Webservice: " + webServiceInfo);
authToken = webServiceInfo.substring(12, 44);
Log.e("Auth token:", "Webservice: " + authToken);

}

} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}

}
</code></pre>

<p>And after getting authToken I open a web page but I am unable to back
on my application again.</p>

<pre><code> private void openURL() {
webView.loadUrl("https://www.fitbit.com/oauth/authorize?oauth_token="
+ authToken + "&amp;display=touch");
}
</code></pre>
14847721True2013-02-04 12:33:30256551880048<android><callback><fitbit>222
9
15516770MapMyFitness API authorization not using the correct callback<p>I have been working with <code>MapMyFitness API</code>. I had it working and the authorization ran smoothly. Within the last two months it seems that something has either changed with my code or with their API.</p>

<p>During the request I make the following call:</p>

<pre><code>header("Location: http://api.mapmyfitness.com/3.1/oauth/authorize?oauth_token=123456789&amp;oauth_callback=mysite.com/authorize.php);
</code></pre>

<p>It correctly sends me to the MapMyFitness site to grant access. I enter in a valid username and password and then it redirects me to:</p>

<pre><code>http://api.mapmyfitness.com/3.1/oauth/mysite.com/authorize.php?oauth_token=123456789
</code></pre>

<p>Of course the website and token are made up for this example. If I remove the first part and am left with the actual callback, <code>mysite.com/authorize.php?oauth_token=123456789</code> it runs correctly.</p>

<p>It appears that MapMyFitness is not correctly handling my <code>callback</code> and adding its <code>oauth url</code>.</p>

<p>If I add <code>http://</code> to the callback I get the error:</p>

<pre><code>Unknown request token ""Array ( [oauth_token] =&gt;


f36a684c04ef71d0a129dd59f5bbc1ed0514b4598 [oauth_callback] =&gt; SITE [PHPSESSID] =&gt;
p284bpatpiuu78t0105qal4ql4 [fbsr_44829295357] =&gt; om1lyMi6U5iIyXqI3nfoWSBW5IoNV8skkJ-
fvW5qec8.eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImNvZGUiOiJBUUFkSExOMkc0eWEtZk1NOF91WGtaNDhKMWN
DSmFQVnZEVm95RjZEdXRsNDVuYVRIUHNRdGxMRVhIQW9QSnJrNnhqWlZreTN6NzZCV1RTQWNaTXVTdl9HWEFNMDJkQ3p
1OE80dkhYT3lhUmdHVWl3bmdqcFF4SXYwQl9PUURNRlJzaG5wMDh2bjQ5UUI2S191ZHR5dXB5Z1dwbFNRdndqYTBiQ0h
IVExWN0ZialM5cnpjRGtnS0tVN2xyRVFXMVM2RTNkTzRQZHM1TnJjX0RrLVp3alEyRS0iLCJpc3N1ZWRfYXQiOjEzNjM
4ODQ3NTgsInVzZXJfaWQiOiIxMjcxODUyNTg0In0 [__utma] =&gt;
252565653.331108727.1353966538.1363678118.1363880367.12 [__utmc] =&gt; 252565653 [__utmv] =&gt;
252565653.|1=sex=M=1^2=age_group=35to44=1^3=membership=free=1^4=logged_in=is_logged_in=1
[__utmz] =&gt; 252565653.1363678118.11.4.utmcsr=mapmyrun.com|utmccn=
(referral)|utmcmd=referral|utmcct=/api/3.1/oauth/authorize
[mp_d4aec1d8aa5a6d2aebd49ec451910dea_mixpanel] =&gt; {"distinct_id": "13d37eedea042c-0033ca7c4-
376f6050-1aeaa0-13d37eedea1e62","$initial_referrer": "$direct","$initial_referring_domain":
"$direct","$search_engine": "google"} [optimizelyBuckets] =&gt; {} [optimizelySegments] =&gt;
{"173102711":"safari","173022868":"false","172178767":"referral"} [__gads] =&gt;
ID=2f74fc63a6725ad5:T=1362443034:S=ALNI_MblJOxnkm6q4rFDE8wihC_cUXHETQ [mmfsessid] =&gt;
5a0f4259-05ae-4fe9-a45e-aa9f90afdfba [fbm_44829295357] =&gt; base_domain=.mapmyfitness.com
[optimizelyEndUserId] =&gt; oeu1353966536109r0.12621341994963586 )
</code></pre>
False2013-03-20 06:29:36110952189549<api><oauth><callback><authorize><mapmyfitness>25
10
16195289Fitbit Subscription API<p>I have successfully integrated FitBit api in my website using Fitbit's PHP library (www.disciplinexgames.com/fitbit). It's working fine but I want to use the subscription API now, so that we can update the data in the database as soon as new data becomes available. I have went through the Subscription API docs and registered the app with subscriber end point but when it comes to getting the update notifications I get lost. Didn't really got much help from the docs in terms of what should I add or change in my code, etc. Is there any sample code for PHP related to subscription API or suggestions of what I should be doing.</p>

<p>Working URL: <a href="http://www.disciplinexgames.com/fitbit/">http://www.disciplinexgames.com/fitbit/</a></p>

<p>Any help will be really appreciated. It's a bit frustrated as I am not getting any error but at the same time no update notifications as well.</p>

<p>Thanks</p>
False2013-04-24 14:57:01529182220743<fitbit>202
11
16666294How can I connect to the FitBit Zip over Bluetooth 4.0 LE on Linux with bluez?<p>I purchased a FitBit zip. This device uses Bluetooth 4.0 LE. I would like to at least connect to it via bluez. If that is successful I want to see how much of the protocol I can figure out.</p>

<p>I am using a Lenovo P500 Ideapad which has integrated support for Bluetooth 4.0. It seems to work (kind of)</p>

<p>When I do:</p>

<pre><code>hcitool lescan
</code></pre>

<p>I am able to find the device's bluetooth address, which (though potentially irrelevant) is: CF:D9:24:DB:F4:7B</p>

<p>Now, I read in another question: <a href="https://stackoverflow.com/questions/15657007/bluetooth-low-energy-listening-for-notifications-indications-in-linux">Bluetooth Low Energy: listening for notifications/indications in linux</a> that I can listen for notifications and other protocol features. I've worked with old bluetooth, but I have no experience with bluetooth LE.</p>

<p>I am getting stuck trying to use <code>hcitool lecc</code> or <code>gatttool</code> to connect to the device. The connection times out and seems to leave bluetooth in a bad state on the Linux box. I am able to fix that by reloading bluetooth related kernel modules.</p>

<p>Any hints are appreciated. I'm trying with the latest bluez now.</p>
21832044True2013-05-21 09:16:092516314615740<linux><reverse-engineering><bluez><fitbit>208
12
16882011strsplit error when attempting to access Fitbit with ROAuth<p>I am attempting to access the fitbit API using ROAuth but keep falling at the first hurdle.</p>

<p>Here is my code:</p>

<pre><code>library(ROAuth)

reqURL &lt;- "https://api.fitbit.com/oauth/request_token"
accessURL &lt;- "https://api.fitbit.com/oauth/access_token"
authURL &lt;- "https://www.fitbit.com/oauth/authorize"
cKey &lt;- "xxxxx"
cSecret &lt;- "xxxxx"

credentials &lt;- OAuthFactory$new(consumerKey=cKey,
consumerSecret=cSecret,
requestURL=reqURL,
accessURL=accessURL,
authURL=authURL)
credentials$handshake()
</code></pre>

<p>Running this gives the following rather cryptic error:</p>

<pre><code>Error in strsplit(response, "&amp;") : non-character argument
</code></pre>

<p>Any suggestions, greatly appreciated!</p>
16931452True2013-06-02 10:45:4307971543437<r><oauth><fitbit>17
13
17066810Withings: getting oauth_callback to.. call back?<p>Im working with the <code>withings</code> oauth implementation in hopes of retrieving stored values from scales. I can get the request token which I send back in hopes of getting the <strong>userid</strong> and the <strong>oauth_verifier</strong> passed back to my application. </p>

<p>What is happening is that if I pass in a full URL via the <strong>oauth_callback</strong> ( EG "<a href="http://some.site.com/myapp.php" rel="nofollow">http://some.site.com/myapp.php</a>" ) the withings page displays the results on its page. But if I pass in just a page ( EG "myapp.php" ) withings will append this page name to its site and attempt to pass the parameters there (resulting in a 404). (EG "<a href="http://oauth.withings.com/account/myapp.php?oauth_params=" rel="nofollow">http://oauth.withings.com/account/myapp.php?oauth_params=</a>..." ).</p>

<p>Other bits:<br>
1. Code is in Perl<br>
2. All <strong>oauth_signature</strong> values are <code>HMAC_SHA1</code> signed<br>
3. Any bits passed on the URL are url encoded using <code>uri_escape</code></p>

<p>My questions:<br>
1. Has anyone succeeded in getting data from withings?<br>
2. Has anyone seen and overcome this problem with <strong>oauth_callback</strong>?</p>
17157831True2013-06-12 13:28:431475491682<oauth><withings>10
14
17768235What function in R package httr performs request and imports activities from Fitbit API?<p>I have used the <code>httr</code> package in R to obtain access to the Fitbit API, but I'm uncertain on which function I should use to extract activities from the API. </p>

<p>Any help would be much appreciated. Please provide example code with the function.</p>

<hr>

<p>I believe I have found one possible answer.</p>

<p>Using the setup inputs from this stackoverflow answer/question: <a href="https://stackoverflow.com/questions/12212958/oauth-authentification-to-fitbit-using-httr">httr fitbit API question</a>.</p>

<p>Once I gained authorization I then used the <code>httr</code> function <code>GET</code>.</p>

<pre><code>GET(url= paste0("http://api.fitbit.com/1/user/-/activities/date/2013-06-07.json"), config=sig)
</code></pre>

<p>In the config argument, the <code>sig</code> variable was derived from the answer/question linked above.</p>
17770449True2013-07-21 01:26:3617551518441<r><api><httr><fitbit>10
15
17895832AFNetworking get request, getting NSURLErrorDomain Code=-1005<p>I'm trying to make an app that connects to a web service with OAUth 1, and I'm having some trouble. Here is my method with my get request:</p>

<pre><code>- (void)loadUserProfile
{
AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:[baseUrl]];
NSMutableURLRequest *request = [httpClient requestWithMethod:@"GET"
path:[NSString stringWithFormat:@"/1/user/%@/profile.json", [SSKeychain passwordForService:@"[service]" account:@"encoded_user_id"]]
parameters:nil];

NSString *postString = [NSString stringWithFormat:@"oauth_consumer_key=%@&amp;oauth_token=%@&amp;oauth_nonce=%@&amp;oauth_signature_method=%@&amp;oauth_timestamp=%@&amp;oauth_version=%@", self.auth.consumerKey, [SSKeychain passwordForService:@"[service]" account:@"oauth_token"], self.auth.nonce, self.auth.signatureMethod, self.auth.timestamp, self.auth.version];
[request setHTTPBody:[postString dataUsingEncoding:NSUTF8StringEncoding]];

AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
[httpClient registerHTTPOperationClass:[AFHTTPRequestOperation class]];
[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
// Print the response body in text
NSLog(@"Response: %@", [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding]);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"Error: %@", error);
}];
[operation start];
}
</code></pre>

<p>When I call this method I get the following error:</p>

<pre><code>Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo=0x8efa7f0 {NSErrorFailingURLStringKey=https://api.fitbit.com/1/user/[id]/profile.json, NSErrorFailingURLKey=https://api.fitbit.com/1/user/[id]/profile.json, NSLocalizedDescription=The network connection was lost., NSUnderlyingError=0x8bdb2c0 "The network connection was lost."}
</code></pre>

<p>The resource I'm trying to get is documented here: <a href="https://wiki.fitbit.com/display/API/OAuth+Authentication+in+the+Fitbit+API#OAuthAuthenticationintheFitbitAPI-tokenCredentials" rel="nofollow">https://wiki.fitbit.com/display/API/OAuth+Authentication+in+the+Fitbit+API#OAuthAuthenticationintheFitbitAPI-tokenCredentials</a>.</p>

<p>I havn't used <code>OAuth 1</code> before, I have never seen this error before, so I'm not sure how to solve it. Any ideas?</p>
17917780True2013-07-27 08:29:2203158756148<objective-c><cocoa-touch><oauth><afnetworking><fitbit>30
16
17938645Implementing OAuth 1.0 in an iOS app (Withings api)<p>I'm developing an iOS app with Withings api.
I've been trying to implement OAuth 1.0 in an iOS app but I couldn't.
I saw <a href="https://stackoverflow.com/questions/15930628/implementing-oauth-1-0-in-an-ios-app">Implementing OAuth 1.0 in an iOS app</a> page.
And at the second answer he suggested TDOAuth <a href="https://github.com/tweetdeck/TDOAuth" rel="nofollow noreferrer">https://github.com/tweetdeck/TDOAuth</a>.
I tried the code and got many errors.
If anyone has code examples or projects, please share through this page.</p>
False2013-07-30 05:01:46515492632557<ios><oauth><withings>301
17
18204570After authenticating token(ACCESS GRANTED), doesn't redirect to Callback URL<p>I'm implementing <code>OAuth 1.0</code> in an <code>iOS app</code> using <a href="https://github.com/Christian-Hansen/simple-oauth1" rel="nofollow">simple-oauth1</a> project. I use <code>Withings api</code> so I modified a little bit from simple-oauth1(like consumer oauth key, secret key, callback url...). And I inserted </p>

<blockquote>
<p>NSLog(request.URL.absoluteString); like the following code(It's in
OAuth1Controller.m)</p>
</blockquote>

<pre><code>- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)
request navigationType:(UIWebViewNavigationType)navigationType
{
if (_delegateHandler) {
NSString *urlWithoutQueryString = [request.URL.absoluteString componentsSeparatedByString:@"?"][0];
NSLog(request.URL.absoluteString);
if ([urlWithoutQueryString rangeOfString:OAUTH_CALLBACK].location != NSNotFound)
{
</code></pre>

<p>With that code,</p>

<ol>
<li><p>I tap the <code>OAuth login</code> button then webview shows login page.</p></li>
<li><p>I enter ID/password.</p></li>
<li><p>Webview shows account allow page. I tap "Allow" button. (NSLog shows <a href="http://oauth.withings.com/account/authorize?acceptDelegation=true&amp;oauth_consumer_key=blahblah&amp;oauth_nonce=blahblah&amp;oauth_signature=blahblah&amp;oauth_signature_method=HMAC-SHA1&amp;oauth_timestamp=blahblah&amp;oauth_token=blahblah&amp;oauth_version=1.0&amp;userid=blahblah" rel="nofollow">http://oauth.withings.com/account/authorize?acceptDelegation=true&amp;oauth_consumer_key=blahblah&amp;oauth_nonce=blahblah&amp;oauth_signature=blahblah&amp;oauth_signature_method=HMAC-SHA1&amp;oauth_timestamp=blahblah&amp;oauth_token=blahblah&amp;oauth_version=1.0&amp;userid=blahblah</a>)</p></li>
</ol>

<p>After above process, webview shows "ACCESS GRANTED" page with oauth_token= blahblah, oauth_verifier=blahblah. But it doesn't redirect to Callback url, it stays at the "ACCESS GRANTED"page.</p>

<p>I've been doing this for about 2 weeks but I cannot find the answer why is this happening.</p>
False2013-08-13 08:48:2105952632557<iphone><ios><api><oauth><withings>11
18
18320618Withings API not redirecting to my callback url (PHP / OAuth)<p>I'm following the guide provided <a href="http://www.withings.com/fr/api/oauthguide" rel="nofollow">here</a> in order to get permanent access to a Withings account via the OAuth protocol. Everything works perfectly until the last part of the second step:</p>

<blockquote>
<p>Authorize this token :<br>
... Then the User allows by clicking on
"Allow" button and he will be redirected to the callback url you set
at the beginning of this step. ...</p>
</blockquote>

<p>However, when the user hits Allow, I am not redirected to my callback url. Instead, I am directed to an "Access Granted" Withings page with an oauth_token and an oauth_verifier. </p>

<p>Please help? </p>

<p>The example they have show the following:</p>

<pre><code>&gt; https://oauth.withings.com/account/authorize?

&gt; oauth_callback=http%3A%2F%2Fexample.com%2Fget_access_token
&gt; &amp;oauth_consumer_key=c331c571585e7c518c78656f41582e96fc1c2b926cf77648223dd76424b52b
&gt; &amp;oauth_nonce=369f9ceb2f285ac637c9a7e9e98019bd
&gt; &amp;oauth_signature=OR9J9iEl%2F2yGOXP2wk5c2%2BWtYvU%3D
&gt; &amp;oauth_signature_method=HMAC-SHA1
&gt; &amp;oauth_timestamp=1311778988
&gt; &amp;oauth_token=5bb105d2292ff43ec9c0f633fee9033045ed4643e9871b80ce586dc1bf945
&gt; &amp;oauth_version=1.0
</code></pre>

<p>While my call looks like this:</p>

<pre><code>&gt; https://oauth.withings.com/account/authorize?

&gt; oauth_callback=http%3A%2F%2Fmysite.com
&gt; &amp;oauth_consumer_key=myConsumerKey
&gt; &amp;oauth_nonce=1234
&gt; &amp;oauth_signature=6mQ5iICsxxJyunjrGlZLMFNbUQA%3D
&gt; &amp;oauth_signature_method=HMAC-SHA1
&gt; &amp;oauth_timestamp=1376934855
&gt; &amp;oauth_token=myOauthToken
&gt; &amp;oauth_version=1.0
</code></pre>

<p>This is my php code:</p>

<pre><code>$callback_uri = rawurlencode("http://www.mysite.com");
$authorization_uri =
"https://oauth.withings.com/account/authorize?" .
'oauth_callback=' . $callback_uri .
'&amp;oauth_consumer_key=' . $oauth_params['oauth_consumer_key'] .
'&amp;oauth_nonce=' . $oauth_params['oauth_nonce'] .
'&amp;oauth_signature=' . rawurlencode($oauth_signature) .
'&amp;oauth_signature_method=' . $oauth_params['oauth_signature_method'] .
'&amp;oauth_timestamp=' . $oauth_params['oauth_timestamp'] .
'&amp;' . $token .
'&amp;oauth_version=' . $oauth_params['oauth_version'];

header("Location: " . $authorization_uri);
</code></pre>
18323964True2013-08-19 18:30:59227732446178<php><api><oauth><withings>10
19
18452968MapMyFitness API OAuth questions<p>I am having some issues with MapMyFitness API. MapMyFitness uses OAuth 1.0</p>

<p>I am able to successfully get a temporary Authorization token/temporary secret Token combination from calling 3.1/oauth/request_token</p>

<p>After that, I am able to successfully direct the user to the Authorization page and get a redirect callback with a authorization verifier.</p>

<p>After that, I am, unfortunately, getting errors when trying to call 3.1/oauth/access_token. (HTTP error 401)</p>

<p>First of all, MMF documentation (<a href="http://api.mapmyfitness.com/3.1/oauth/access_token?doc" rel="nofollow">http://api.mapmyfitness.com/3.1/oauth/access_token?doc</a>) states: Exchange a request token and an authorization verifier for an access token. However, the list of input arguments in the documentation contains no mention of oauth_verifier. Should oauth_verifier that I have received with the redirect callback be passed to access_token call as an argument?</p>

<p>Secondly, it appears to me that perhaps I am not creating the signature correctly. For the 3.1/oauth/request_token call the key to generate the signature is 'XXX&amp;' where XXX is the Consumer Secret Key assigned to my app by MapMyFitness. This works fine. For the 3.1/oauth/access_token call, I am using 'XXX&amp;YYY' as a signature key where XXX is the Consumer Secret Key assigned to my app by MapMyFitness and YYY is the temporary Secret Token returned to me by the server during the 3.1/oauth/request_token call. Is that correct?</p>

<p>I would greatly appreciate any suggestions.</p>
18472732True2013-08-26 21:03:3208492422875<ios><api><oauth><mapmyfitness>101
20
19361836Signing errors from Withings Rest API<p>all</p>

<p>I have an app that is successfully getting authorized using Withing's api and OAuth.</p>

<p>I get the auth page from whitings, and I get the resulting token and verifier, however I can not make requests with those - I keep getting a 342 error: The signature (using Oauth) is invalid.</p>

<p>Code:</p>

<pre><code>&lt;?
require("include.php");
require_once("OAuth.php");


$domain = "oauth.withings.com";
$base = "/account/";
$base_url = "https://$domain$base";

$hmac_method = new OAuthSignatureMethod_HMAC_SHA1();
$consumer = new OAuthConsumer("my key goes here :-)", "my key goes here :-)", "http://oauth.corp.withings.com/test.php");

$sig_method = $hmac_method;

$username="mydbusername";

$mySQL=" select * from `healthtokens` where service='WITHINGS' and userid='".$username."'";
$data=mysql_query($mySQL) or die("Died at 2&lt;BR&gt;".mysql_error());

$tokenrow = mysql_fetch_array( $data );

$serviceuserid=$tokenrow['serviceuserid'];
$otoken=$tokenrow['otoken'];
$overifier=$tokenrow['overifier'];

$acc_tok = new OAuthToken($otoken,$overifier);



$req = OAuthRequest::from_consumer_and_token($consumer, $acc_tok, "GET", "http://wbsapi.withings.net/user?action=getbyuserid&amp;userid=".$serviceuserid);
$req-&gt;sign_request($sig_method, $consumer, $acc_tok);


$response = file_get_contents($req);


echo $response;


?&gt;
</code></pre>

<p>Withings API docs: <a href="http://www.withings.com/en/api" rel="nofollow">http://www.withings.com/en/api</a></p>

<p>An example of my call:</p>

<p><a href="http://wbsapi.withings.net/user?action=getbyuserid&amp;oauth_consumer_key=mybigconsumerkeyishere&amp;oauth_nonce=f57a956d52c7412326fb0577e87addc4&amp;oauth_signature=jiBNvql5r06HysjjVyxCh7C7ZUk%3D&amp;oauth_signature_method=HMAC-SHA1&amp;oauth_timestamp=1381758029&amp;oauth_token=4088d6173b78b71cfd6ddd4245496de4b1f7b3c45bfb49f8e59b1202ccfc&amp;oauth_version=1.0&amp;userid=1234567" rel="nofollow">http://wbsapi.withings.net/user?action=getbyuserid&amp;oauth_consumer_key=mybigconsumerkeyishere&amp;oauth_nonce=f57a956d52c7412326fb0577e87addc4&amp;oauth_signature=jiBNvql5r06HysjjVyxCh7C7ZUk%3D&amp;oauth_signature_method=HMAC-SHA1&amp;oauth_timestamp=1381758029&amp;oauth_token=4088d6173b78b71cfd6ddd4245496de4b1f7b3c45bfb49f8e59b1202ccfc&amp;oauth_version=1.0&amp;userid=1234567</a></p>
False2013-10-14 13:52:0701307677351<php><oauth><withings>10
21
19368687Withings API - accessing protected resources<p>I'm writing an iOS app that pulls Withings data and am using code from simple-oauth1 (which I previously used successfully to talk to the Fitbit API). I successfully obtained a request token, authenticated it, and then obtained an access token. Then I proceeded to make sure the groundwork was set for accessing protected resources by sending an oauthenticated GET request to <a href="http://wbsapi.withings.net/once?action=probe" rel="nofollow">http://wbsapi.withings.net/once?action=probe</a>
I got an error code 0 (everything seems to be working...)
However when I try to make any other calls to <a href="http://wbsapi.withings.net" rel="nofollow">http://wbsapi.withings.net</a>, I'm confronted with error 250 ("The provided userid and/or Oauth credentials do not match"). </p>

<p>Here is what the code looks like:</p>

<pre><code>- (void)getUserInfo
{
NSString *path = @"measure";
NSMutableDictionary *moreParams = [[NSMutableDictionary alloc] init];
[moreParams setValue:@"getmeas" forKey:@"action"];
[moreParams setValue:@"1234567" forKey:@"userid"];

NSURLRequest *preparedRequest = [OAuth1Controller preparedRequestForPath:path
parameters:moreParams
HTTPmethod:@"GET"
oauthToken:self.oauthToken
oauthSecret:self.oauthTokenSecret];

[NSURLConnection sendAsynchronousRequest:preparedRequest
queue:NSOperationQueue.mainQueue
completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
dispatch_async(dispatch_get_main_queue(), ^{

if (error) NSLog(@"Error in API request: %@", error.localizedDescription);
});
}];
}
</code></pre>

<p>This is how the request is being formatted (Christian's code in OAuth1Controller.m):</p>

<pre><code>+ (NSURLRequest *)preparedRequestForPath:(NSString *)path
parameters:(NSDictionary *)queryParameters
HTTPmethod:(NSString *)HTTPmethod
oauthToken:(NSString *)oauth_token
oauthSecret:(NSString *)oauth_token_secret
{
if (!HTTPmethod
|| !oauth_token) return nil;

NSMutableDictionary *allParameters = [self standardOauthParameters].mutableCopy;

allParameters[@"oauth_token"] = oauth_token;

if (queryParameters) {
[allParameters addEntriesFromDictionary:queryParameters];
}

NSString *parametersString = CHQueryStringFromParametersWithEncoding(allParameters, NSUTF8StringEncoding);

NSString *request_url = API_URL;
if (path) request_url = [request_url stringByAppendingString:path];
NSString *oauth_consumer_secret = CONSUMER_SECRET;
NSString *baseString = [HTTPmethod stringByAppendingFormat:@"&amp;%@&amp;%@", request_url.utf8AndURLEncode, parametersString.utf8AndURLEncode];
NSString *secretString = [oauth_consumer_secret.utf8AndURLEncode stringByAppendingFormat:@"&amp;%@", oauth_token_secret.utf8AndURLEncode];

NSString *oauth_signature = [self.class signClearText:baseString withSecret:secretString];

allParameters[@"oauth_signature"] = oauth_signature;
allParameters[@"oauth_signature_method"] = @"HMAC-SHA1";

NSString *queryString;

if (queryParameters) {
queryString = CHQueryStringFromParametersWithEncoding(queryParameters, NSUTF8StringEncoding);
}
if (queryString) {
request_url = [request_url stringByAppendingFormat:@"?%@", queryString];
}

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:request_url]];
request.HTTPMethod = HTTPmethod;

NSMutableArray *parameterPairs = [NSMutableArray array];
[allParameters removeObjectsForKeys:queryParameters.allKeys];

for (NSString *name in allParameters) {
NSString *aPair = [name stringByAppendingFormat:@"=\"%@\"", [allParameters[name] utf8AndURLEncode]];
[parameterPairs addObject:aPair];
}

NSString *oAuthHeader = [@"OAuth " stringByAppendingFormat:@"%@", [parameterPairs componentsJoinedByString:@","]];
[request setValue:oAuthHeader forHTTPHeaderField:@"Authorization"];

return request;
}
</code></pre>

<p>I'm sure I have the correct userid (redacted here as "1234567") but I'm not sure why I can't use it to pull data. I have a feeling this is where the code is breaking. Please help.</p>
False2013-10-14 20:26:0735722048686<ios><api><withings>112
22
19719242How do I initialize the fitbit Fitgem client in config/initializers?<h3>For convention reasons I would like to initialize the Fitgem client in config/initializers/fitgem.rb. When I say initialize I mean pass in my app's consumer token and consumer secret like so:</h3>
<pre><code>Fitgem.configure do |config|
config.consumer_key = &quot;XXXX&quot;
config.consumer_secret = &quot;XXXX&quot;
config.token = &quot;XXXX&quot;
config.secret = &quot;XXXX&quot;
end
</code></pre>
<p>This is the exact same manner that is done with Facebook and Twitter clients (<a href="https://github.com/sferik/twitter" rel="nofollow noreferrer">https://github.com/sferik/twitter</a>) elsewhere. Is there a similar way I can do this with Fitgem?</p>
<h2>The error I receive when I try to initialize the client this way is:</h2>
<p><em><strong>undefined method `configure' for Fitgem:Module</strong></em></p>
<p>The fitgem docs (<a href="http://www.rubydoc.info/github/whazzmaster/fitgem/frames" rel="nofollow noreferrer">http://www.rubydoc.info/github/whazzmaster/fitgem/frames</a>) say to do it like this:</p>
<pre><code>client = Fitgem::Client.new {
:consumer_key =&gt; my_key,
:consumer_secret =&gt; my_secret,
:token =&gt; fitbit_oauth_token,
:secret =&gt; fitbit_oauth_secret
}
</code></pre>
<p>But I don't want to have to re-initialize the Fitgem client in every method.</p>
<h3>So, number 1, I would love to know how to do this, and number 2 I would love to know how to look at the fitgem code to see that configure is not an acceptable method.</h3>
26210022True2013-11-01 01:01:4303282628223<ruby><rubygems><ruby-on-rails-4><fitbit>11
23
19955423Establish connection with Scribe and SharedPreferences<p>When I connect directly after logging in everything works great. Then I store to SharedPreferences values request (first token to access login site - although I know it is not needed...), pin (pin also not needed), access_token and access_secret... </p>

<p>I try to make a connection using data stored SharedPreferences... </p>

<pre><code>OAuthService service= new ServiceBuilder()
.provider(FitbitApi.class)
.apiKey( oauth_consumer_key )
.apiSecret( oauth_consumer_secret )
.build();
Log.d("TOKEN", access_token.getToken());
OAuthRequest request = new OAuthRequest(Verb.GET, PROTECTED_RESOURCE_ACTIVITIES_URL);
service.signRequest(access_token, request);

Response response = request.send();
</code></pre>

<p>and I receive error:</p>

<pre><code>11-13 14:40:55.657: W/dalvikvm(9502): threadid=1: thread exiting with uncaught exception (group=0x418e8898)
11-13 14:40:55.657: E/AndroidRuntime(9502): FATAL EXCEPTION: main
11-13 14:40:55.657: E/AndroidRuntime(9502): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.iecom.fitbitgb/com.iecom.fitbitgb.FitBitLogin}: org.scribe.exceptions.OAuthConnectionException: There was a problem while creating a connection to the remote service.
11-13 14:40:55.657: E/AndroidRuntime(9502): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2295)
11-13 14:40:55.657: E/AndroidRuntime(9502): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2349)
11-13 14:40:55.657: E/AndroidRuntime(9502): at android.app.ActivityThread.access$700(ActivityThread.java:159)
11-13 14:40:55.657: E/AndroidRuntime(9502): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
11-13 14:40:55.657: E/AndroidRuntime(9502): at android.os.Handler.dispatchMessage(Handler.java:99)
11-13 14:40:55.657: E/AndroidRuntime(9502): at android.os.Looper.loop(Looper.java:137)
11-13 14:40:55.657: E/AndroidRuntime(9502): at android.app.ActivityThread.main(ActivityThread.java:5419)
11-13 14:40:55.657: E/AndroidRuntime(9502): at java.lang.reflect.Method.invokeNative(Native Method)
11-13 14:40:55.657: E/AndroidRuntime(9502): at java.lang.reflect.Method.invoke(Method.java:525)
11-13 14:40:55.657: E/AndroidRuntime(9502): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1187)
11-13 14:40:55.657: E/AndroidRuntime(9502): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
11-13 14:40:55.657: E/AndroidRuntime(9502): at dalvik.system.NativeStart.main(Native Method)
11-13 14:40:55.657: E/AndroidRuntime(9502): Caused by: org.scribe.exceptions.OAuthConnectionException: There was a problem while creating a connection to the remote service.
11-13 14:40:55.657: E/AndroidRuntime(9502): at org.scribe.model.Request.send(Request.java:70)
11-13 14:40:55.657: E/AndroidRuntime(9502): at org.scribe.model.Request.send(Request.java:76)
11-13 14:40:55.657: E/AndroidRuntime(9502): at com.iecom.fitbitgb.FitBitCommunicator.getUserActivity(FitBitCommunicator.java:43)
11-13 14:40:55.657: E/AndroidRuntime(9502): at com.iecom.fitbitgb.FitBitLogin.onCreate(FitBitLogin.java:46)
11-13 14:40:55.657: E/AndroidRuntime(9502): at android.app.Activity.performCreate(Activity.java:5372)
11-13 14:40:55.657: E/AndroidRuntime(9502): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1104)
11-13 14:40:55.657: E/AndroidRuntime(9502): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2257)
11-13 14:40:55.657: E/AndroidRuntime(9502): ... 11 more
11-13 14:40:55.657: E/AndroidRuntime(9502): Caused by: android.os.NetworkOnMainThreadException
11-13 14:40:55.657: E/AndroidRuntime(9502): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1144)
11-13 14:40:55.657: E/AndroidRuntime(9502): at java.net.InetAddress.lookupHostByName(InetAddress.java:385)
11-13 14:40:55.657: E/AndroidRuntime(9502): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:236)
11-13 14:40:55.657: E/AndroidRuntime(9502): at java.net.InetAddress.getAllByName(InetAddress.java:214)
11-13 14:40:55.657: E/AndroidRuntime(9502): at libcore.net.http.HttpConnection.&lt;init&gt;(HttpConnection.java:70)
11-13 14:40:55.657: E/AndroidRuntime(9502): at libcore.net.http.HttpConnection.&lt;init&gt;(HttpConnection.java:50)
11-13 14:40:55.657: E/AndroidRuntime(9502): at libcore.net.http.HttpConnection$Address.connect(HttpConnection.java:340)
11-13 14:40:55.657: E/AndroidRuntime(9502): at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:87)
11-13 14:40:55.657: E/AndroidRuntime(9502): at libcore.net.http.HttpConnection.connect(HttpConnection.java:128)
11-13 14:40:55.657: E/AndroidRuntime(9502): at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:316)
11-13 14:40:55.657: E/AndroidRuntime(9502): at libcore.net.http.HttpEngine.connect(HttpEngine.java:311)
11-13 14:40:55.657: E/AndroidRuntime(9502): at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:290)
11-13 14:40:55.657: E/AndroidRuntime(9502): at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:240)
11-13 14:40:55.657: E/AndroidRuntime(9502): at libcore.net.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:81)
11-13 14:40:55.657: E/AndroidRuntime(9502): at org.scribe.model.Response.&lt;init&gt;(Response.java:29)
11-13 14:40:55.657: E/AndroidRuntime(9502): at org.scribe.model.Request.doSend(Request.java:117)
11-13 14:40:55.657: E/AndroidRuntime(9502): at org.scribe.model.Request.send(Request.java:66)
11-13 14:40:55.657: E/AndroidRuntime(9502): ... 17 more
</code></pre>

<p>I believe that I do something wrong when newly constructing OAuthService... any idea?</p>
20474436True2013-11-13 13:43:360958675004<android><oauth><scribe><fitbit>121
24
20121141Getting started with Withings API<p>How i connect to my website and withing api.I send weight value to withing api and get body measurement value.And where i will get withing api code.</p>

<pre><code>$config['withings_settings']['widgets'] = 'TRUE';
$config['withings_settings']['enabled'] = 'TRUE';
$config['withings_settings']['consumer_key'] = 'c65e4bff78de924609d8cce4dce837f2d931e0f13e8d9dbcbbdcf6f0c97cd';
$config['withings_settings']['consumer_secret'] = 'ec75fc954c37b57c67f8bc0ee6f1226d78b22ded5f173e73fd331f78ef0';
$config['withings_settings']['social_connection'] = 'TRUE';
$config['withings_settings']['connections_redirect']= 'settings/connections/';
$config['withings_settings']['archive'] = '';

/* Sites */
$config['withings_sites'][] = array(
'url' =&gt; 'http://withings.com/',
'module' =&gt; 'withings',
'type' =&gt; 'remote',
'title' =&gt; 'Withings',
'favicon' =&gt; 'http://withings.com/favicon.ico'
);

class OAuth_Provider_Withings extends OAuth_Provider {

public $name = 'withings';
public $uid_key = 'user_id';

public function get_user_info(OAuth_Consumer $consumer, OAuth_Token $token)
{
// Create a new GET request with the required parameters
$request = OAuth_Request::forge('resource', 'GET', 'http://wbsapi.withings.net/measure?action=getmeas&amp;userid=933243', array(
'oauth_consumer_key' =&gt; $consumer-&gt;key,
'oauth_token' =&gt; $token-&gt;access_token
));

// Sign the request using the consumer and token
$request-&gt;sign($this-&gt;signature, $consumer, $token);

$activities = $request-&gt;execute();

// Create a response from the request
return $activities;
}

}
</code></pre>

<p>I need get measurement response from withings whatever user submit a bodyweight.I need reference code for withing api and i also need step to access.Because i didnt use this before.</p>

<p>Advance thanks.</p>
False2013-11-21 12:34:24211022960703<javascript><php><api><withings>10
25
20593446MapMyFitness i/o usage<p>(This post may cause me bad reputation, but anyway)</p>

<p>There's the portal for sport activity sharing - <a href="http://www.mapmyfitness.com/" rel="nofollow">MapMyFitness</a></p>

<p>And here's <a href="https://developer.mapmyapi.com/" rel="nofollow">their API</a></p>

<p>I want to test Post Workout in <a href="https://developer.mapmyapi.com/io-docs" rel="nofollow">I/O docs</a>. The fields are:</p>

<pre><code>activity_type /v7.0/activity_type/16/

aggregates test

name Run / Jog

privacy /v7.0/privacy_option/3/

start_datetime Sat, 14 Dec 2013 12:22:43 GMT

start_locale_timezone US/Central
</code></pre>

<p>But still I have the next error:</p>

<pre><code> "error_message": "Could not deserialize body as given content type"
</code></pre>

<p>What am I doing wrong?</p>

<p>P.S. Unfortunately, I didn't find any community or active forum to help.</p>
False2013-12-15 10:20:4401931040347<json><web-services><api><mapmyfitness>10
26
20786603FitBit API integration IOS<p>I am using FitBit API to get Activities. In response I am getting a JSON array of activities. For each activity they provides some details like name, activityId, calories,etc but date and time is not available. Is there any API to get activity details along with start date and time.</p>
20786716True2013-12-26 14:37:46132111029657<ios><iphone><fitbit>32
27
21160084getting userinformation after successful redirection from withings using withings example code<p>I have successful redirection(callback url) from withings using withings example code.</p>

<pre><code>http://wbsapi.withings.com/cgi-bin/measure?action=getmeas&amp;devtype=1
&amp;oauth_consumer_key=xxxxxxxxx
&amp;oauth_nonce=xxxxxxx
&amp;oauth_signature=xxxxx
&amp;oauth_signature_method=yyyy
&amp;oauth_timestamp=yyyyy
&amp;oauth_token=xxxxxx
&amp;oauth_version=1.0&amp;userid=xxx
</code></pre>

<p>I have successfully generated <code>auth_token</code> and <code>oauth_token_secret</code>.</p>

<pre><code>Array( [oauth_token] =&gt; xxxxxxxxxxxxxxxxxxxxxxx[oauth_token_secret] =&gt; xxxxxxxxxxxxxxxx).

https://oauth.withings.com/account/access_token?
oauth_consumer_key=xxxxxxxxxxxxxxxxx
&amp;oauth_nonce=xxxx
&amp;oauth_signature=xxxxxxx
&amp;oauth_signature_method=yyyyy
&amp;oauth_timestamp=yyyyyyy
&amp;oauth_token=yyyyyy
&amp;oauth_version=1.0
&amp;userid=xxxx
</code></pre>

<p>I have successful redirection(callback url) from withings. But I can't get user information. I need help to get user infomation.</p>

<p>Following like this:</p>

<ol>
<li>First name</li>
<li>Last name</li>
<li>email</li>
<li>weight</li>
<li>etc.</li>
</ol>
False2014-01-16 11:09:5212752960703<php><api><oauth><withings>12
28
21359467Rails save unique token and secrets for different users (REST api)<p>I'm building an rails app with the fitgem (fitbit) api. Currently I can get it to work for one user by creating a .fitgem.yml file. I would like each user to get a unique .fitgem.yml file. How is this possible?</p>

<p>Thanks</p>

<p>.fitgem.yml</p>

<pre><code>---
:oauth:
:consumer_key: [integers]
:consumer_secret: [integers]
:token: [integers]
:secret: [integers]
:user_id: [integers]
</code></pre>

<p>Thanks</p>
False2014-01-26 03:53:2915422228688<ruby-on-rails><ruby><ruby-on-rails-3><rest><fitbit>12
29
21373160DotNetOpenAuth 4.3 - Changing the default signing behavior<p>I am using DotNetOpenAuth 4.3 to integrate FitBit into my web application. I was able to authorize users successfully up until a few days ago when I started receiving the following error from FitBit when trying to swap the request token with an access token:</p>

<p>{"errors":[{"errorType":"oauth","fieldName":"oauth_access_token","message":"Invalid signature or token 'PpUuhUBgLXZrLvKQoaS+Tt4Blc4=' or token '4c5623004d03e71094b7a7f0d2ded338'"}],"success":false}</p>

<p>I've searched around and found this thread which I believe matches the problem I am having:
<a href="https://groups.google.com/forum/#!msg/fitbit-api/ii4pUt4uTNM/mPORlYWqs0wJ" rel="nofollow">https://groups.google.com/forum/#!msg/fitbit-api/ii4pUt4uTNM/mPORlYWqs0wJ</a></p>

<p>The gist of that thread is that FitBit recently started enforcing that the oauth_signature parameter be signed with the following:</p>

<blockquote>
<p>Requests to <a href="https://api.fitbit.com/oauth/access_token" rel="nofollow">https://api.fitbit.com/oauth/access_token</a> need to be signed with your <strong>application's consumer key and secret and the oauth_token and oauth_verifier</strong> received from the authorization callback.</p>
</blockquote>

<p>In other words, it looks like we need to sign with 4 parameters. I looked at the source code of DotNetOpenAuth and saw the following method on the OAuth1HmacSha1HttpMessageHandler class (I am using an HmacSha1SigningBindingElement in my ServiceProviderDescription):</p>

<pre><code>protected override byte[] Sign(byte[] signedPayload) {
using (var algorithm = HMACSHA1.Create()) {
algorithm.Key = Encoding.ASCII.GetBytes(this.GetConsumerAndTokenSecretString());
return algorithm.ComputeHash(signedPayload);
}
}
</code></pre>

<p>It appears as though this signing behavior only uses two parameters: the consumer and token secret (returned via this.GetConsumerAndTokenSecretString()).</p>

<p>My question is:</p>

<p>Is changing the type of message handler and overriding the behavior of the Sign method the proper way to fix this issue? And if so, is there a way to change the signing behavior of my WebConsumer? I was thinking that I could create a subclass of OAuth1HttpMessageHandlerBase and override this behavior but there does not seem to be a clean way to change the MessageHandler of my web consumer.</p>

<p>Thanks!</p>
False2014-01-27 04:43:291215270682<oauth><dotnetopenauth><fitbit>00
30
21383821Fitbit oAuth using PHP cURL - request token returns blank screen<p>I am trying to get issue a cURL request for "request token" method using Fitbit API. Problem is it does not show anything but a blank screen. However this process is suppose to give me an "access token" which I can use to generate a login URL to authenticate users and give access to my app.</p>

<p>I know there is oAuth php class for this but my server doesn't support oAuth so got to use cURL only. Please help! Many thanks in advance.</p>

<pre><code>&lt;?php
define('FITBIT_KEY', '&lt;consumer key from fitbit website&gt;');
define('FITBIT_SECRET', '&lt;consumer secret from fitbit website&gt;');

function buildBaseString($baseURI, $method, $params)
{
$r = array();
ksort($params);
foreach($params as $key=&gt;$value){
$r[] = "$key=" . rawurlencode($value);
}

return $method."&amp;" . rawurlencode($baseURI) . '&amp;' . rawurlencode(implode('&amp;', $r)); //return complete base string
}

function buildAuthorizationHeader($oauth)
{
$r = 'Authorization: OAuth ';
$values = array();
foreach($oauth as $key=&gt;$value)
$values[] = "$key=\"" . rawurlencode($value) . "\"";

$r .= implode(', ', $values);
return $r;
}

$url = "http://api.fitbit.com/oauth/request_token";

$oauth = array( 'oauth_consumer_key' =&gt; FITBIT_KEY,
'oauth_consumer_secret' =&gt; FITBIT_SECRET,
'oauth_nonce' =&gt; time(),
'oauth_signature_method' =&gt; 'HMAC-SHA1',
'oauth_timestamp' =&gt; time(),
'oauth_version' =&gt; '1.0',
'oauth_callback' =&gt; 'http://h1.servy.net/zerocuisine/index.php');
$base_info = buildBaseString($url, 'GET', $oauth);
$composite_key = rawurlencode(FITBIT_SECRET) . '&amp;';
$oauth_signature = base64_encode(hash_hmac('sha1', $base_info, $composite_key, true));
$oauth['oauth_signature'] = $oauth_signature;

$header = array(buildAuthorizationHeader($oauth), 'Expect:');
$options = array( CURLOPT_HTTPHEADER =&gt; $header,
CURLOPT_HEADER =&gt; false,
CURLOPT_URL =&gt; $url,
CURLOPT_RETURNTRANSFER =&gt; true,
CURLOPT_SSL_VERIFYPEER =&gt; false);

$feed = curl_init();
curl_setopt_array($feed, $options);
$json = curl_exec($feed);
curl_close($feed);

$fitbit_data = json_decode($json);

echo '&lt;pre&gt;'.print_r($fitbit_data,true).'&lt;/pre&gt;'; ?&gt;
</code></pre>
False2014-01-27 14:47:37198969794<php><curl><oauth><fitbit>101
31
21458662OAuth 1.0a Implementation with PHP Pecl - Custom Signature (Fitbit)<p>I had an implementation of OAuth working with Fitbit to pull data from fitbit's service. However they recently updated their service and now the request is failing whenever I try to get an access token.</p>

<p>They have made the following statement about the new requirement:</p>

<pre><code>The solution is to OAuth sign the requests to &lt;https://api.fitbit.com/oauth/request_token&gt; and &lt;https://api.fitbit.com/oauth/access_token&gt; in a similar manner that all other calls to the Fitbit API are signed.

Requests to &lt;https://api.fitbit.com/oauth/request_token&gt; need to be signed with your application's consumer key and secret.
Requests to &lt;https://api.fitbit.com/oauth/access_token&gt; need to be signed with your application's consumer key and secret and the oauth_token and oauth_verifier received from the authorization callback.
</code></pre>

<p>I am using the PHP PECL OAuth library for OAuth requests. However I can't find a way to add additional parameters to the signature. I am trying the following but I'm not sure that this is the correct way to update the OAuth Signature:</p>

<pre><code>$params['consumer_key'] = $this-&gt;consumer_key;
$params['consumer_secret'] = $this-&gt;consumer_secret;
$params['oauth_token'] = $this-&gt;oauth_token;
$params['oauth_verifier'] = $_REQUEST['oauth_verifier'];

$this-&gt;signature = $this-&gt;oauth-&gt;generateSignature('GET', $this-&gt;access_url, $params);
$this-&gt;access_token = $this-&gt;oauth-&gt;getAccessToken($this-&gt;access_url, $this-&gt;signature, $_REQUEST['oauth_verifier']);
</code></pre>

<p>The OAuth error I get is:</p>

<pre><code>401
Invalid auth/bad request (got a 401, expected HTTP/1.1 20X or a redirect)
oauthoauth_signatureInvalid signature: FfvYDv5MSOfwcOwLZBJa0TlKS4Q=false
</code></pre>

<p>The signature which is stored from the code above shows that the proper signature should be:</p>

<pre><code>[signature] =&gt; wlfzqPs4aEkTkHfqyaO65D/RW6o=
</code></pre>

<p>This is the "Headers Sent" piece of the debug information:</p>

<pre><code>[headers_sent] =&gt; Authorization: OAuth oauth_session_handle="Frdnxw8oHe3BgNVi0Fy4jBXrZko%3D",
oauth_verifier="ss6nmke8elf3so66jg3auued49",
oauth_consumer_key="(my key)",
oauth_signature_method="HMAC-SHA1",
oauth_nonce="30463910852ea5cc2d04e60.71895372",
oauth_timestamp="1391090882",
oauth_version="1.0",
oauth_token="2cabd6beab341e332bdf8e522b6019ef",
oauth_signature="hULwWcQOl%2F8aYjh0YjR843iVXtA%3D"
</code></pre>

<p>I can't find anything in the documentation which explains how I can set the signature for OAuth to use with it's request. Any Help would be greatly appreciated!!!</p>

<p>Please let me know if you need more information!</p>
21638058True2014-01-30 14:06:0805141873148<php><oauth><fitbit>10
32
21460360OAuth 1.0b receiving access token<p>Until few days ago everything worked fine. But after some changes on FitBit new user can not get OAuth handshake anymore. The problem is when I receive temporary tokens and make call to finish handshake and receive credentials.</p>

<p>So in first step I get:</p>

<pre><code>TOKEN: 1a227cfde686220183763946a98173bc and VERIFIER: p2g5ims7o4ffscev603rbif05g
</code></pre>

<p>and in second step I use theme to make call to <a href="https://api.fitbit.com/oauth/access_token" rel="nofollow">https://api.fitbit.com/oauth/access_token</a> ... </p>

<p>Signature Base String is: </p>

<pre><code>POST&amp;https%3A%2F%2Fapi.fitbit.com%2Foauth%2Faccess_token&amp;oauth_consumer_key%3D7c5e888aa3dd4d17a26d82a7f541b278%26oauth_token%3D1a227cfde686220183763946a98173bc%26oauth_nonce%3D5hw45lgu%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1391094796%26oauth_verifier%3Dp2g5ims7o4ffscev603rbif05g%26oauth_version%3D1.0
</code></pre>

<p>And by that I receive header (with signature calculated using the same function as in first step)</p>

<pre><code>Authorizing with HEADER: OAuth oauth_consumer_key="7c5e888aa3dd4d17a26d82a7f541b278",oauth_token="1a227cfde686220183763946a98173bc",oauth_nonce="5hw45lgu",oauth_signature="X4udgn9A7Q2xI%2FN38QELl%2BIDVqM%3D",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1391094796",oauth_verifier="p2g5ims7o4ffscev603rbif05g",oauth_version="1.0"
</code></pre>

<p>That should work but I get 401 error saying:</p>

<pre><code>{"errors":[{"errorType":"oauth","fieldName":"oauth_access_token","message":"Invalid signature or token 'JNGSIMomid/oghtWGrz7crC6KhM=' or token '6c45d0ce39195e848da14cad0a4f9719'"}],"success":false}
</code></pre>

<p>I have been working od that for 7 hours now ... and as far as I can see everything is OK ... Error is saying about field name oauth_access_token ... This fields doesn't even exist. I tried anyway and recived error saying that security is not OK ... </p>

<p>Any Idea?</p>
False2014-01-30 15:18:340940675004<oauth><fitbit>10
33
21547363Error occurs when logging into Withings OAuth API in IOS<p>I'm trying to use <a href="https://github.com/Christian-Hansen/simple-oauth1" rel="nofollow">simple-oauth1</a> to log into the <strong>Withings API</strong>. I am able to get the login page to appear, but when I enter my account details and then hit sign in, the page just refreshes instead of taking me to the "authorize app" page. </p>

<p>I'm using the following settings at the top of <code>OAuth1Controller.m</code> - haven't changed anything else. (You'll have to replace the consumer key and secret with your own copies.)</p>

<pre><code>#define OAUTH_CALLBACK @"http://www.mysite.com"
#define CONSUMER_KEY @"REDACTED"
#define CONSUMER_SECRET @"REDACTED"
#define AUTH_URL @"https://oauth.withings.com/"
#define REQUEST_TOKEN_URL @"account/request_token"
#define AUTHENTICATE_URL @"account/authorize"
#define ACCESS_TOKEN_URL @"account/access_token"
#define API_URL @"https://oauth.withings.com"
#define OAUTH_SCOPE_PARAM @""
</code></pre>

<p>Can anyone tell me what I'm doing wrong here? I'm able to use the exact same code to login to the <strong>Fitbit API</strong> just fine.</p>
False2014-02-04 08:27:4302411593765<ios><oauth><withings>10
34
21571740Omniauth.rb Fitbit expecting keyword_end<p>I'm trying to set up omniauth with the <a href="/questions/tagged/fitbit" class="post-tag" title="show questions tagged &#39;fitbit&#39;" rel="tag">fitbit</a> api.</p>

<p>I created a file in <strong>config/initializers/omniauth.rb</strong>:</p>

<pre><code>Rails.application.config.middleware.use OmniAuth::Builder do
provider :fitbit, b4aaad9b1 , 88bd74511f
#NOT THE ACTUAL KEYS - I deleted middle numbers to preserve formatting
end
</code></pre>

<p>when I run:</p>

<pre><code>rails s
</code></pre>

<p>I receive the error</p>

<pre><code>gems/ruby-1.9.3-p448@rails3tutorial2ndEd/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:245:in `load': config/initializers/omniauth.rb:3: syntax error, unexpected tIDENTIFIER, expecting keyword_end (SyntaxError)
</code></pre>

<p>Any ideas how to fit this. I am very new to <a href="/questions/tagged/oauth-2.0" class="post-tag" title="show questions tagged &#39;oauth-2.0&#39;" rel="tag">oauth-2.0</a> and <a href="/questions/tagged/omniauth" class="post-tag" title="show questions tagged &#39;omniauth&#39;" rel="tag">omniauth</a>:</p>

<p>thanks</p>
21573883True2014-02-05 08:07:5002672228688<ruby-on-rails><ruby><oauth-2.0><omniauth><fitbit>12
35
21620428Rails DangerousAttributeError Oauth Return Perimeter from API<p>I'm trying to connect with the fitbit api. I'm trying to learn Oauth on Rails</p>

<p>device/controller</p>

<pre><code>def create
device = request.env["omniauth.auth"]
current_user.devices.find_or_create_by_provider_and_oauth_token_and_oauth_verifier(device['provider'], device['oauth_token'], device["oauth_verifier"])
flash[:notice] = "Device Successfully connected."
redirect_to devices_url
end
</code></pre>

<p>So, I make a call to fitbit with my credentials asking for a users token and verifiers. I'm receiving back the parameters:</p>

<pre><code>{"oauth_token"=&gt;"1c...d7e",
</code></pre>

<p>"oauth_verifier"=>"li...i5",
"provider"=>"fitbit"}</p>

<p>and receiving the error:</p>

<pre><code>ActiveRecord::DangerousAttributeError in DevicesController#create
</code></pre>

<p>any ideas on how to fix this? thanks</p>
False2014-02-07 06:02:161312228688<ruby-on-rails><ruby-on-rails-3><oauth><fitbit>00
36
21669568how to start with Withings API in grails project<p>I went through some of the documents of the Withings API <a href="http://www.withings.com/en/api" rel="nofollow">reference url</a> and I registered my application <a href="http://www.withings.com/en/api/oauthguide#registration" rel="nofollow">here</a>, even though I don't got any basic idea on how to start with this API like,</p>

<ol>
<li>how to find user's detail?</li>
<li>who will approve our application and how the user will allow us to access their data? like a lot, please help me in this.</li>
</ol>
False2014-02-10 05:13:381652534236<api><grails><withings>00
37
21781367how to retrive access tokens from oauth for withings in c#?<p>I an new in dotnet and i want to retrive access tokens from oauth i have api key and secret but when i creat final url to be hit to retrive tokens it response (The remote server returned an error: (500) Internal Server Error.)
My final url is
<a href="https://oauth.withings.com/account/request_token?oauth_callback=https://localhost:15626/Default.aspx&amp;oauth_consumer_key=18cb37fb4fb6fbf75288c2e70d373cdefe535689fd1de80756feec2622e&amp;oauth_nonce=2794396&amp;oauth_signature_method=HMAC-SHA1&amp;oauth_signature=sX4nv2hedzTU9Qih8RFw%3d&amp;oauth_timestamp=1392386140&amp;oauth_version=1.0" rel="nofollow">https://oauth.withings.com/account/request_token?oauth_callback=https://localhost:15626/Default.aspx&amp;oauth_consumer_key=18cb37fb4fb6fbf75288c2e70d373cdefe535689fd1de80756feec2622e&amp;oauth_nonce=2794396&amp;oauth_signature_method=HMAC-SHA1&amp;oauth_signature=sX4nv2hedzTU9Qih8RFw%3d&amp;oauth_timestamp=1392386140&amp;oauth_version=1.0</a></p>

<p>please help me to successfuly retriving oauth token and oauth secret. thank you.</p>
False2014-02-14 13:58:4814893107246<c#><asp.net><oauth><withings>12
38
21788331Oauth Client creation User_controller ERROR Rails 'fitgem'<p>I'm trying to let my user make GET requests to the Fitbit API. Currently the user has all of their tokens, but I'm struggling to create a client. </p>

<p>User_controller.rb</p>

<pre><code>def show
@user = User.find(params[:id])
if (@user.device != nil)
p "PRINTING DEVICES"
p @user.device
@device = @user.device

@client = Fitgem::Client.new(
:consumer_key =&gt; 'b4aacb5c2c8c43e2a6873877cd2ad9b1',
:consumer_secret =&gt; '88bd78fc86d84d6c9aa7b1c0b8d4511f',
:token =&gt; @device.oauth_token,
:secret =&gt; @device.oauth_token_secret
)
end
end
</code></pre>

<p>The error I am receiving is:</p>

<pre><code> /Users/Marcus/Sites/Rails/rails_projects/BattleOfTheBands/app/controllers/users_controller.rb: 16: syntax error, unexpected tASSOC, expecting ')'
:consumer_key =&gt; 'b4b1',
^
/Users/Marcus/Sites/Rails/rails_projects/BattleOfTheBands/app/controllers/users_controller.rb:16: syntax error, unexpected ',', expecting keyword_end
/Users/Marcus/Sites/Rails/rails_projects/BattleOfTheBands/app/controllers/users_controller.rb:17: syntax error, unexpected ',', expecting keyword_end
/Users/Marcus/Sites/Rails/rails_projects/BattleOfTheBands/app/controllers/users_controller.rb:19: syntax error, unexpected tASSOC, expecting tCOLON2 or '[' or '.'
:secret =&gt; @device.oauth_token_secret
^
/Users/Marcus/Sites/Rails/rails_projects/BattleOfTheBands/app/controllers/users_controller.rb:21: syntax error, unexpected ')', expecting keyword_end
/Users/Marcus/Sites/Rails/rails_projects/BattleOfTheBands/app/controllers/users_controller.rb:86: syntax error, unexpected $end, expecting keyword_end
</code></pre>
False2014-02-14 19:49:4611132228688<ruby-on-rails-3><oauth-2.0><client><fitbit>01
39
21862223Not able to convert string to json<p>i am getting measurements from withings and want to show them in graphs but not able to convert it to json. i also try <code>JsonConvert.SerializeObject(myString)</code> using <code>Newtonsoft.dll</code>and simple</p>

<pre><code>System.Web.Script.Serialization.JavaScriptSerializer sr = new System.Web.Script.Serialization.JavaScriptSerializer();
sr.Serialize(myString);
</code></pre>

<p>but it is not converting.</p>

<p>My withings measurement string is as follows.</p>

<pre><code>{
"status": 0,
"body": {
"updatetime": 1392764547,
"measuregrps": [
{
"grpid": 17945868,
"attrib": 0,
"date": 139984270,
"category": 1,
"measures": [
{
"value": 72,
"type": 9,
"unit": 0
},
{
"value": 152,
"type": 10,
"unit": 7
},
{
"value": 87,
"type": 17,
"unit": 0
}
]
},
{
"grpid": 176587495,
"attrib": 0,
"date": 13915689,
"category": 1,
"measures": [
{
"value": 94,
"type": 9,
"unit": 0
},
{
"value": 145,
"type": 10,
"unit": 0
},
{
"value": 109,
"type": 11,
"unit": 0
}
]
},
{
"grpid": 179262494,
"attrib": 0,
"date": 1391369607,
"category": 1,
"measures": [
{
"value": 77,
"type": 9,
"unit": 0
},
{
"value": 121,
"type": 10,
"unit": 0
},
{
"value": 87,
"type": 11,
"unit": 0
}
]
},
{
"grpid": 179258492,
"attrib": 0,
"date": 1391171167,
"category": 1,
"measures": [
{
"value": 61,
"type": 9,
"unit": 0
},
{
"value": 107,
"type": 10,
"unit": 0
},
{
"value": 80,
"type": 11,
"unit": 0
}
]
},
{
"grpid": 179089150,
"attrib": 0,
"date": 1391167537,
"category": 1,
"measures": [
{
"value": 69,
"type": 9,
"unit": 0
},
{
"value": 112,
"type": 10,
"unit": 0
},
{
"value": 67,
"type": 11,
"unit": 0
}
]
},
{
"grpid": 179079661,
"attrib": 2,
"date": 1391164672,
"category": 1,
"measures": [
{
"value": 720,
"type": 1,
"unit": -1
}
]
},
{
"grpid": 17998560,
"attrib": 2,
"date": 146989672,
"category": 1,
"measures": [
{
"value": 284,
"type": 4,
"unit": -2
}
]
}
]
}
}
</code></pre>
21863066True2014-02-18 18:21:33-22013107246<c#><asp.net><json><json.net><withings>23
40
22423877Can I Call FitBit API from Desktop application<p>I need to integrate with Fitbit API. it uses OAuth 1.0 for authentication. Can I call API from a .NET desktop application. I have seen code snippets with OAuth.NET but they are calling the API from web application. Let me further expand the question</p>

<p>Can I make Oauth request from a desktop application if yes how? I have read somewhere on the net that twitter allows its clients to call from desktop app. </p>

<p>My desktop app will not have any URL,so what will be the value of CallBackURL when creating OAuth.NET request.
review the following code for detail</p>

<pre><code>OAuthRequest request = OAuthRequest.Create(
new EndPoint(ApiCallUrl, "GET"), // API call url
service, // consumer configuration
this.Context.Request.Url, // callback url
this.Context.Session.SessionID // session id
);
</code></pre>
False2014-03-15 12:35:3011165331174<.net><oauth><desktop-application><fitbit>101
41
22672078(AS3) Gathering data from fitbit api<p>I'm trying to setup a mini game using the fitbit API. I need to grab some of the user(s) data for game manip. I'm not 100% how I would access them.  This is my current attempt but doesn't work. I was trying to follow this thread <a href="https://groups.google.com/d/msg/fitbit-api/n0yv3-dzAqY/8y6old2EItQJ" rel="nofollow">https://groups.google.com/d/msg/fitbit-api/n0yv3-dzAqY/8y6old2EItQJ</a>.  If I'm way off or there is a better idea, please let me know. This is getting to unknown territory. After I get this working and will post finished app.</p>

<pre><code>package
{
import flash.display.Sprite;
import flash.events.Event;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.net.URLRequestHeader;
import flash.net.URLRequestMethod;

import org.iotashan.oauth.IOAuthSignatureMethod;
import org.iotashan.oauth.OAuthConsumer;
import org.iotashan.oauth.OAuthRequest;
import org.iotashan.oauth.OAuthSignatureMethod_HMAC_SHA1;
import org.iotashan.oauth.OAuthToken;

public class Fitbit extends Sprite
{

private static var CONSUMER_SECRET:String = "xxxxxxxxxx";
private static var CONSUMER_KEY:String = "xxxxxxxxxx";
private static var REQUEST_TOKEN_URL:String = "http://api.fitbit.com/oauth/request_token";
//private static var REQUEST_TOKEN_URL:String = "https://www.fitbit.com/oauth/authorize?oauth_token=";
private static var ACCESS_TOKEN_URL:String = "http://api.fitbit.com/oauth/access_token";
private static var AUTHORIZE_URL:String = "http://www.fitbit.com/oauth/authorize";
private static var API_URL:String = "http://api.fitbit.com";
private static var SIGNATURE:IOAuthSignatureMethod = new OAuthSignatureMethod_HMAC_SHA1();

public function Fitbit()
{
var consumer:OAuthConsumer = new OAuthConsumer(CONSUMER_KEY,CONSUMER_SECRET);
var token:OAuthToken = new OAuthToken(CONSUMER_KEY,CONSUMER_SECRET);
var mainRequest:OAuthRequest = new OAuthRequest(URLRequestMethod.GET,API_URL+'/1/user/2FV43Z/profile.json',null,consumer,token);
var getDataHead:URLRequestHeader = mainRequest.buildRequest(SIGNATURE, "header", API_URL);
var getDataURL:URLRequest = new URLRequest(API_URL+'/1/user/2FV43Z/profile.json');
getDataURL.requestHeaders.push(getDataHead);
var getDataLoader:URLLoader = new URLLoader();
getDataLoader.load(getDataURL);
getDataLoader.addEventListener(Event.COMPLETE,onLoadComplete);
getDataLoader.addEventListener(IOErrorEvent.IO_ERROR, onError);
}

public function onError(e:IOErrorEvent):void {
trace(e.currentTarget.data);
1+1;
}

public function onLoadComplete(e:Event):void {
trace("FINISHED");
1+1;
}
}
</code></pre>

<p>}</p>
False2014-03-26 20:15:2113963217176<flash><actionscript-3><fitbit>031
42
22800564Fitbit API issues using PHP<p>Brand new to the Fitbit API but this is what I've got so far.</p>

<ul>
<li>I've successfully installed OAuth on my server and verified.</li>
<li>I downloaded Fitbit's PHP example - completeAuthorization.php however
after browsing to it on my server and clicking "Allow" it takes me to
localexample.fitbit.com/php/completeAuthorization.php?oauth_token=...&amp;oauth_verifier=...
which is a 404. oauth_token and oauth_verifier removed to protect the
innocent</li>
<li><p>I drop that idea and then try to use the GitHub project FitbitPHP and
created (based on their README.md file) the following:</p>

<p>

<pre><code>require 'fitbitphp.php';

$fitbit = new FitBitPHP(FITBIT_KEY, FITBIT_SECRET);

$fitbit-&gt;setUser('XXXXXX');
$xml = $fitbit-&gt;getProfile();

print_r($xml);
</code></pre></li>
</ul>

<p>The XXXXXX is my 6 digit user ID I pulled from my profile. The screen is rendering a blank white page and I'm not sure how to diagnose this. I used the API Explorer and seemed to have positive results. Could someone provide some much needed direction? My goal is to simply output my profile data so I can style it on a webpage. Thanks in advance.</p>

<p>Sources:</p>

<p><a href="https://github.com/heyitspavel/fitbitphp" rel="nofollow">FitbitPHP on GitHub</a></p>

<p><a href="https://wiki.fitbit.com/display/API/API+PHP+Client" rel="nofollow">Fitbit API docs using PHP</a> </p>
22800924True2014-04-02 02:44:5301875602514<php><api><fitbit>23
43
22994663App hangs on Resuming screen after logging in through WebAuthenticationBroker<p><strong>Update:</strong> This only seems to happen when I run the application in the emulator. Everything is working as expected when I run it on a real device.</p>

<hr>

<p>I am using <a href="http://msdn.microsoft.com/library/windows/apps/br227025" rel="nofollow">WebAuthenticationBroker</a> in my app to let the user authenticate to Fitbit via OAuth.</p>

<p>The WebAuthenticationBroker succesffully passes me back the args (i.e. the final URI containing the token and secret), and I am able to make the subsequent call to retrieve the access token from Fitbit. All of this works <a href="https://wiki.fitbit.com/display/API/OAuth+Authentication+in+the+Fitbit+API" rel="nofollow">as expected</a>.</p>

<p>My problem is that the app then hangs on the "Resuming..." marching ants screen. This happens right after the WebAuthenticationBroker Fitbit login screen goes away and is not related to any code of mine that is executed after that. I have removed all of that code and it still happens.</p>

<p>The call I use to launch the WebAuthenticationBroker is</p>

<pre><code>string CallBackUrl = "http://localhost:8080/Fitbit/Callback";

string oauth_token = await GetFitbitRequestTokenAsync(CallBackUrl, ConsumerKey);

string FitbitUrl = "https://www.fitbit.com/oauth/authorize?oauth_token=" + oauth_token;

System.Uri StartUri = new Uri(FitbitUrl);
System.Uri EndUri = new Uri(CallBackUrl);

WebAuthenticationBroker.AuthenticateAndContinue(StartUri, EndUri, null, WebAuthenticationOptions.None);
</code></pre>

<p>I assume I am missing a step after all of this, which is needed to return to my app's page. I have already tried various things I could think of, but I am not sure where and how I need to do this for it to work.</p>

<p>The way I am getting the CallbackUrl with the token/secret args back from WebAuthenticationManager is</p>

<pre><code>protected async override void OnActivated(IActivatedEventArgs e)
{
base.OnActivated(e);

var args = e as IContinuationActivatedEventArgs;
if (args != null &amp;&amp; args.Kind == ActivationKind.WebAuthenticationBrokerContinuation)
{
Frame rootFrame = Window.Current.Content as Frame;
var wabPage = rootFrame.Content as IWebAuthenticationContinuable;
wabPage.ContinueWebAuthentication(args as WebAuthenticationBrokerContinuationEventArgs);
}

Window.Current.Activate();
}
</code></pre>

<p>Help is greatly appreciated! :)</p>

<p>_ rndsum</p>
False2014-04-10 17:12:2613593517614<oauth><windows-phone-8.1><fitbit>00
44
23016790Withings API No Response on request_token<p>I have setup everything as described in the steps in answer to the post <a href="https://stackoverflow.com/questions/15129751/withings-api-authentication">withings api authentication</a>.</p>

<p>However, when i copy and paste the final URL generated in Step 2 (Send request to the URL:), I get no response on my browser and the screen remains empty.</p>

<p>Is there any reason for why it might be happening ?
OAUTH TOKEN and OAUTH SECRET - will I get two of them appended to callback url ?</p>
23271050True2014-04-11 15:30:0424083361121<http><oauth><withings>21
45
23129057How can I receive FitBit data from my own iOS app?<p>I know there's a RESTful API for FitBit (<a href="https://wiki.fitbit.com/display/API/Fitbit+API" rel="nofollow">https://wiki.fitbit.com/display/API/Fitbit+API</a>), but I'm interested in incorporating FitBit data directly via BLE into my iOS app.</p>

<p>Doesn't seem this is officially supported, since there aren't API docs for the BLE local protocol.</p>

<p>Anyone have any success doing this, despite the lack of official docs?</p>
False2014-04-17 09:12:4813393544584<ios><bluetooth-lowenergy><fitbit>01
46
23221726Laravel PHP Fitbit API OAUTH - storing and reusing access tokens<p>I am currently using the fitbit library with a laravel wrapper (see <a href="https://github.com/popthestack/fitbitphp" rel="nofollow">https://github.com/popthestack/fitbitphp</a>).</p>

<p>I am attempting to store the access token once a user authenticates and then subsequently reuse that token instead of having to make a separate request for a new token each time. Is it possible using fitbits oauth 1 implementation to reuse the access tokens or will I need to make a new request using request tokens etc. each time. I apologize in advance, I have a fairly visceral understanding of oauth in the first place but fitbit in particular has been tripping me up. Thanks.</p>

<p>here is the function I have that requests info from fitbit...</p>

<pre><code>public function getFitbit() {
// get data from input
$code = Input::get( 'oauth_token' );

// get fb service
$fb = fitbitOauth::consumer( 'Fitbit' );

// if code is provided get user data and sign in
if ( !empty( $code ) ) {
// This was a callback request from fitbit, get the token
$fb-&gt;requestAccessToken(
$_GET['oauth_token'],
$_GET['oauth_verifier']
);

// Send a request now that we have access token
$result = json_decode($fb-&gt;request('user/-/profile.json'));

print_r($result);

}
// if not ask for permission first
else {
// get fb authorization
$token = $fb-&gt;requestRequestToken();
$url = $fb-&gt;getAuthorizationUri(array('oauth_token' =&gt; $token-&gt;getRequestToken()));

// return to facebook login url
return Redirect::to( (string)$url );
}
}
</code></pre>

<p>I can run through the above example. Direct a user to the page where they can authenticate their account. This then redirects to a page that displays their info. If I reload the page with the 'token' and 'verifier' set already it fails. I want to be able to save off their token to a DB and reference it in the future.</p>
False2014-04-22 13:59:15210751106676<php><oauth><laravel-4><fitbit>061
47
23318818Withings API: Access Shared User Measurement Data<p>I am trying to access measurement data for users that have shared access to my Withings account. I can access my own measurement data, but not data for their user ids. Is this access even possible for through the API?</p>

<p>Whenever I change the <code>userid</code> to one other than my own, I get the error code indicating an invalid userid was given.</p>

<pre><code>http://wbsapi.withings.net/measure?action=getmeas&amp;startdate=122281920&amp;userid=12345
</code></pre>

<p>gives me this in PHP</p>

<pre><code>stdClass Object
(
[status] =&gt; 247
)
</code></pre>
23347868True2014-04-27 02:47:03034849411<php><withings>12
48
23424495communication between android phone and Fitbit devices<p>How Connection between Android Phone and FitBit devices is performed?? I know they are using BLE,In this case how BLE is working??</p>

<p>Is there any documents which clear the concept of FitBit working? </p>

<p>Please Help.thanx</p>
False2014-05-02 09:05:2906752452568<android><fitbit>10
49
23573648Reading Withings API ruby<p>I have been trying for days to pull down activity data from the Withings API using the OAuth Ruby gem. Regardless of what method I try I consistently get back a 503 error response (not enough params) even though I copied the example URI from the documentation, having of course swapped out the userid. Has anybody had any luck with this in the past. I hope it is just something stupid I am doing.</p>

<pre><code>class Withings
API_KEY = 'REMOVED'
API_SECRET = 'REMOVED'
CONFIGURATION = { site: 'https://oauth.withings.com', request_token_path: '/account/request_token',
access_token_path: '/account/access_token', authorize_path: '/account/authorize' }

before do
@consumer = OAuth::Consumer.new API_KEY, API_SECRET, CONFIGURATION
@base_url ||= "#{request.env['rack.url_scheme']}://#{request.env['HTTP_HOST']}#{request.env['SCRIPT_NAME']}"
end

get '/' do
@request_token = @consumer.get_request_token oauth_callback: "#{@base_url}/access_token"
session[:token] = @request_token.token
session[:secret] = @request_token.secret

redirect @request_token.authorize_url
end

get '/access_token' do
@request_token = OAuth::RequestToken.new @consumer, session[:token], session[:secret]

@access_token = @request_token.get_access_token oauth_verifier: params[:oauth_verifier]
session[:token] = @access_token.token
session[:secret] = @access_token.secret
session[:userid] = params[:userid]

redirect "#{@base_url}/activity"
end

get '/activity' do
@access_token = OAuth::AccessToken.new @consumer, session[:token], session[:secret]
response = @access_token.get("http://wbsapi.withings.net/v2/measure?action=getactivity&amp;userid=#{session[:userid]}&amp;startdateymd=2014-01-01&amp;enddateymd=2014-05-09")
JSON.parse(response.body)
end
end
</code></pre>

<p>For other API endpoints I get an error response of 247 - The userid provided is absent, or incorrect. This is really frustrating. Thanks</p>
23705513True2014-05-09 20:44:0015601613695<ruby><oauth><withings>10
50
23625491Getting Invalid signature error while invoking FITBIT rest API<p>I have registered in FITBIT.
I am making a request to fitbit api(POST <strong>/oauth/request_token</strong>) with consumer key. I have referred <a href="https://wiki.fitbit.com/display/API/OAuth+Authentication+in+the+Fitbit+API" rel="nofollow">https://wiki.fitbit.com/display/API/OAuth+Authentication+in+the+Fitbit+API</a></p>

<p><strong>My request is:</strong>
POST /request_token HTTP/1.1
Host: oauth
Authorization: OAuth realm="https:/api.fitbit.com/oauth/request_token",oauth_consumer_key="XXXXXXXXXXXX",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1399958922",oauth_nonce="H8xxW0",oauth_version="1.0",oauth_signature="80M1tag6%2FYk2JV%2FQdQ%2BucxxDrLA%3D"
Cache-Control: no-cache</p>

<p><strong>I am getting invalid signature error with below json object:</strong></p>

<pre><code>{
"errors": [
{
"errorType": "oauth",
"fieldName": "oauth_signature",
"message": "Invalid signature: 80M1tag6/Yk2JV/QdQ+ucxxDrLA="
}
],
"success": false }
</code></pre>

<p>We have Consumer Key and Consumer Secret Key. Don't have Token Secret at this stage. please give me a solution to get this API working.</p>

<p>Thanks,
Kalyan</p>
False2014-05-13 07:45:58111052991367<rest><oauth><fitbit>12
51
23713045Diagnosing a NoMethodError that's occurring outside my code<p>I'm using <a href="http://rubygems.org/gems/omniauth" rel="nofollow">omniauth</a> and <a href="http://rubygems.org/gems/omniauth-mapmyfitness-oauth2" rel="nofollow">omniauth-mapmyfitness-oauth2</a> to allow MapMyFitness users to sign in to my site.</p>

<p>Recently, I've had a few sign in attempts result in the error below. It doesn't look like any of the error is occurring in my Rails app's code - it seems like it's entirely within ruby, some gem(s), or the MapMyFitness API.</p>

<p>Any direction/information/suggestions on how to debug this <strong>at all</strong> would be greatly appreciated. I haven't experienced an issue like this before, so it's a huge learning opportunity.</p>

<pre><code>NoMethodError (undefined method `strip' for nil:NilClass):
/usr/lib/ruby/1.9.1/net/http.rb:1435:in `block in initialize_http_header'
/usr/lib/ruby/1.9.1/net/http.rb:1433:in `each'
/usr/lib/ruby/1.9.1/net/http.rb:1433:in `initialize_http_header'
/usr/lib/ruby/1.9.1/net/http.rb:1862:in `initialize'
faraday (0.8.9) lib/faraday/adapter/net_http.rb:55:in `new'
faraday (0.8.9) lib/faraday/adapter/net_http.rb:55:in `create_request'
faraday (0.8.9) lib/faraday/adapter/net_http.rb:75:in `perform_request'
faraday (0.8.9) lib/faraday/adapter/net_http.rb:38:in `call'
faraday (0.8.9) lib/faraday/request/url_encoded.rb:14:in `call'
faraday (0.8.9) lib/faraday/connection.rb:253:in `run_request'
oauth2 (0.9.3) lib/oauth2/client.rb:90:in `request'
oauth2 (0.9.3) lib/oauth2/client.rb:135:in `get_token'
oauth2 (0.9.3) lib/oauth2/strategy/auth_code.rb:29:in `get_token'
omniauth-oauth2 (1.1.2) lib/omniauth/strategies/oauth2.rb:93:in `build_access_token'
omniauth-oauth2 (1.1.2) lib/omniauth/strategies/oauth2.rb:75:in `callback_phase'
omniauth (1.2.1) lib/omniauth/strategy.rb:227:in `callback_call'
omniauth (1.2.1) lib/omniauth/strategy.rb:184:in `call!'
omniauth (1.2.1) lib/omniauth/strategy.rb:164:in `call'
omniauth (1.2.1) lib/omniauth/strategy.rb:186:in `call!'
omniauth (1.2.1) lib/omniauth/strategy.rb:164:in `call'
newrelic_rpm (3.8.0.218) lib/new_relic/rack/error_collector.rb:55:in `call'
newrelic_rpm (3.8.0.218) lib/new_relic/rack/agent_hooks.rb:32:in `call'
newrelic_rpm (3.8.0.218) lib/new_relic/rack/browser_monitoring.rb:27:in `call'
warden (1.2.3) lib/warden/manager.rb:35:in `block in call'
warden (1.2.3) lib/warden/manager.rb:34:in `catch'
warden (1.2.3) lib/warden/manager.rb:34:in `call'
actionpack (3.2.18) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.4.5) lib/rack/etag.rb:23:in `call'
rack (1.4.5) lib/rack/conditionalget.rb:25:in `call'
actionpack (3.2.18) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.2.18) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.2.18) lib/action_dispatch/middleware/flash.rb:242:in `call'
rack (1.4.5) lib/rack/session/abstract/id.rb:210:in `context'
rack (1.4.5) lib/rack/session/abstract/id.rb:205:in `call'
actionpack (3.2.18) lib/action_dispatch/middleware/cookies.rb:341:in `call'
activerecord (3.2.18) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.2.18) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
actionpack (3.2.18) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.18) lib/active_support/callbacks.rb:405:in `_run__3877922931106558540__call__1275774963243928783__callbacks'
activesupport (3.2.18) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.18) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.18) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.18) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (3.2.18) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
airbrake (3.1.16) lib/airbrake/rails/middleware.rb:13:in `call'
actionpack (3.2.18) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.18) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.18) lib/rails/rack/logger.rb:32:in `call_app'
railties (3.2.18) lib/rails/rack/logger.rb:16:in `block in call'
activesupport (3.2.18) lib/active_support/tagged_logging.rb:22:in `tagged'
railties (3.2.18) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.18) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.5) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.5) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.18) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.5) lib/rack/lock.rb:15:in `call'
rack-cache (1.2) lib/rack/cache/context.rb:136:in `forward'
rack-cache (1.2) lib/rack/cache/context.rb:245:in `fetch'
rack-cache (1.2) lib/rack/cache/context.rb:185:in `lookup'
rack-cache (1.2) lib/rack/cache/context.rb:66:in `call!'
rack-cache (1.2) lib/rack/cache/context.rb:51:in `call'
airbrake (3.1.16) lib/airbrake/user_informer.rb:16:in `_call'
airbrake (3.1.16) lib/airbrake/user_informer.rb:12:in `call'
railties (3.2.18) lib/rails/engine.rb:484:in `call'
railties (3.2.18) lib/rails/application.rb:231:in `call'
railties (3.2.18) lib/rails/railtie/configurable.rb:30:in `method_missing'
/usr/lib/ruby/vendor_ruby/phusion_passenger/rack/thread_handler_extension.rb:74:in `process_request'
/usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:141:in `accept_and_process_next_request'
/usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:109:in `main_loop'
/usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler.rb:448:in `block (3 levels) in start_threads'
</code></pre>

<p>I did poke into the <code>/usr/lib/ruby/1.9.1/net/http.rb</code> file, and found a reference to <code>.strip</code> right at line 1435:</p>

<pre><code>def initialize_http_header(initheader)
@header = {}
return unless initheader
initheader.each do |key, value|
warn "net/http: warning: duplicated HTTP header: #{key}" if key?(key) and $VERBOSE
@header[key.downcase] = [value.strip]
end
end
</code></pre>

<p>I don't know what to do with that information, though.</p>
23713265True2014-05-17 15:24:160917359957<ruby-on-rails><ruby><omniauth><mapmyfitness>13
52
24056422how to authentificate through withings api using sribe in java<p>I use scribe librabry for java , that's a library that simplificate oAuth procedure.</p>

<p>I try to write a code for authenticate me in the withings api with java with scribe but i have always the same problem : "Invalide Token".
I don't know what to write in the verifier param in scribe ....</p>

<p>Thanks for your response.</p>

<p>Bye.</p>
26756582True2014-06-05 09:26:0515163284405<java><api><oauth><scribe><withings>12
53
24143629Trying to Authenticate Coldfusion to FitBit API OAuth1<p>This is my first oAuth1 project. I am trying to connect to FitBit's API. I've gone to fitbit, registered an app and recorded my key and secret.</p>

<p>I have then downloaded and attempted to setup:
<a href="http://oauth.riaforge.org/" rel="nofollow noreferrer">http://oauth.riaforge.org/</a></p>

<p>1) I found that I get a connection failure when trying to connect via SSL.. but I think that is a keystore issue. When I go back to http it at least attempts a connection:</p>

<p>2) I am currently using the code from the examples_external/google.cfm file. It seemed to be the closest match.</p>

<p>When I run the code, I receive the response noted below. I am assuming that the oauth client sends the link over as a get with all the values in the URL, and Fitbit wants a POST and it wants an Authentication Header. I've researched as far as I can get but CF examples with Fitbit and Oauth are lacking.</p>

<p>Here is what they are looking for.
<a href="https://wiki.fitbit.com/display/API/OAuth+Authentication+in+the+Fitbit+API" rel="nofollow noreferrer">https://wiki.fitbit.com/display/API/OAuth+Authentication+in+the+Fitbit+API</a></p>

<p>Any guidance would be appreciated.</p>

<pre><code>&lt;!--- set up the parameters ---&gt;
&lt;cfset sConsumerKey = "xxxxx"&gt; &lt;!--- FromFit Bit ---&gt;
&lt;cfset sConsumerSecret = "yyyy"&gt; &lt;!--- From FitBit ---&gt;
&lt;cfset sTokenEndpoint = "http://api.fitbit.com/oauth/request_token"&gt; &lt;!--- Access Token URL ---&gt;
&lt;cfset sAuthorizationEndpoint = "http://www.fitbit.com/oauth/authorize"&gt; &lt;!--- Authorize URL ---&gt;
&lt;cfset sCallbackURL = "http://www.example.com/fitbit/callback.cfm"&gt; &lt;!--- where fitbit will redirect to after the user enters their details ---&gt;
&lt;cfset sClientToken = ""&gt; &lt;!--- returned after an access token call ---&gt;
&lt;cfset sClientTokenSecret = ""&gt; &lt;!--- returned after an access token call ---&gt;
&lt;cfset sScope =''&gt; &lt;!--- required for google ---&gt;

&lt;!--- set up the required objects including signature method---&gt;
&lt;cfset oReqSigMethodSHA = CreateObject("component", "oauth.oauthsignaturemethod_hmac_sha1")&gt;
&lt;cfset oToken = CreateObject("component", "oauth.oauthtoken").createEmptyToken()&gt;
&lt;cfset oConsumer = CreateObject("component", "oauth.oauthconsumer").init(sKey = sConsumerKey, sSecret = sConsumerSecret)&gt;

&lt;cfset Parameters = structNew()&gt;
&lt;cfset parameters.scope = sScope&gt;

&lt;cfset oReq = CreateObject("component", "oauth.oauthrequest").fromConsumerAndToken(
oConsumer = oConsumer,
oToken = oToken,
sHttpMethod = "GET",
sHttpURL = sTokenEndpoint,stparameters=Parameters )&gt;

&lt;cfset oReq.signRequest(
oSignatureMethod = oReqSigMethodSHA,
oConsumer = oConsumer,
oToken = oToken)&gt;


&lt;cfhttp url="#oREQ.getString()#" method="get" result="tokenResponse"/&gt;

&lt;!--- grab the token and secret from the response if its there---&gt;
&lt;cfif findNoCase("oauth_token",tokenresponse.filecontent)&gt;
&lt;cfset sClientToken = listlast(listfirst(tokenResponse.filecontent,"&amp;"),"=")&gt;
&lt;cfset sClientTokenSecret = listlast(listlast(tokenResponse.filecontent,"&amp;"),"=")&gt;

&lt;!--- you can add some additional parameters to the callback ---&gt;
&lt;cfset sCallbackURL = sCallbackURL &amp; "?" &amp;
"key=" &amp; sConsumerKey &amp;
"&amp;" &amp; "secret=" &amp; sConsumerSecret &amp;
"&amp;" &amp; "token=" &amp; sClientToken &amp;
"&amp;" &amp; "token_secret=" &amp; sClientTokenSecret &amp;
"&amp;" &amp; "endpoint=" &amp; URLEncodedFormat(sAuthorizationEndpoint)&gt;

&lt;cfset sAuthURL = sAuthorizationEndpoint &amp; "?oauth_token=" &amp; sClientToken &amp; "&amp;" &amp; "oauth_callback=" &amp; URLEncodedFormat(sCallbackURL) &gt;

&lt;cflocation url="#sAuthURL#"&gt;

&lt;cfelse&gt;
&lt;cfoutput&gt;#tokenResponse.filecontent#&lt;/cfoutput&gt;
&lt;/cfif&gt;
</code></pre>

<p>Returns</p>

<pre><code>{"errors":[{"errorType":"oauth","fieldName":"n/a","message":"No Authorization header provided in the request. Each call to Fitbit API should be OAuth signed"}],"success":false}
</code></pre>

<p><strong>UPDATE:</strong> I was able to get a little bit further with an example I found for someone connecting to linkedin with a similar issue.... updated code:</p>

<pre><code>&lt;!--- set up the parameters ---&gt;
&lt;cfset sConsumerKey = "xxxxx"&gt; &lt;!--- FromFit Bit ---&gt;
&lt;cfset sConsumerSecret = "xxxxxxxx"&gt; &lt;!--- From FitBit ---&gt;
&lt;cfset sTokenEndpoint = "http://api.fitbit.com/oauth/request_token"&gt; &lt;!--- Access Token URL ---&gt;
&lt;cfset sAuthorizationEndpoint = "http://api.fitbit.com/oauth/authorize"&gt; &lt;!--- Authorize URL ---&gt;
&lt;cfset sCallbackURL = "http://www.example.com/fitbit/callback.cfm"&gt; &lt;!--- where fitbit will redirect to after the user enters their details ---&gt;
&lt;cfset sClientToken = ""&gt; &lt;!--- returned after an access token call ---&gt;
&lt;cfset sClientTokenSecret = ""&gt; &lt;!--- returned after an access token call ---&gt;


&lt;!--- set up the required objects including signature method---&gt;
&lt;cfset oReqSigMethodSHA = CreateObject("component", "oauth.oauthsignaturemethod_hmac_sha1")&gt;
&lt;cfset oToken = CreateObject("component", "oauth.oauthtoken").createEmptyToken()&gt;
&lt;cfset oConsumer = CreateObject("component", "oauth.oauthconsumer").init(sKey = sConsumerKey, sSecret = sConsumerSecret)&gt;

&lt;cfset Parameters = structNew()&gt;

&lt;cfset oReq = CreateObject("component", "oauth.oauthrequest").fromConsumerAndToken(
oConsumer = oConsumer,
oToken = oToken,
sHttpMethod = "POST",
sHttpURL = sTokenEndpoint,stparameters=Parameters )&gt;

&lt;cfset oReq.signRequest(
oSignatureMethod = oReqSigMethodSHA,
oConsumer = oConsumer,
oToken = oToken)&gt;


&lt;cfhttp url="#oReq.GETNORMALIZEDHTTPURL()#" method="post" result="tokenresponse"&gt;
&lt;cfhttpparam type="header" name="Authorization" value="#oReq.TOHEADER()#" /&gt;
&lt;/cfhttp&gt;

&lt;!---
FROM HERE DOWN IS ALL FROM EXAMPLE FILE

grab the token and secret from the response if its there---&gt;
&lt;cfif findNoCase("oauth_token",tokenresponse.filecontent)&gt;
&lt;cfset sClientToken = listlast(listfirst(tokenResponse.filecontent,"&amp;"),"=")&gt;
&lt;cfset sClientTokenSecret = listlast(listlast(tokenResponse.filecontent,"&amp;"),"=")&gt;

&lt;!--- you can add some additional parameters to the callback ---&gt;
&lt;cfset sCallbackURL = sCallbackURL &amp; "?" &amp;
"key=" &amp; sConsumerKey &amp;
"&amp;" &amp; "secret=" &amp; sConsumerSecret &amp;
"&amp;" &amp; "token=" &amp; sClientToken &amp;
"&amp;" &amp; "token_secret=" &amp; sClientTokenSecret &amp;
"&amp;" &amp; "endpoint=" &amp; URLEncodedFormat(sAuthorizationEndpoint)&gt;

&lt;cfset sAuthURL = sAuthorizationEndpoint &amp; "?oauth_token=" &amp; sClientToken &amp; "&amp;" &amp; "oauth_callback=" &amp; URLEncodedFormat(sCallbackURL) &gt;

&lt;cflocation url="#sAuthURL#"&gt;

&lt;cfelse&gt;
&lt;cfoutput&gt;#tokenResponse.filecontent#&lt;/cfoutput&gt;
&lt;/cfif&gt;
</code></pre>

<p>However, now I am at the callback.... I thought it would look similar but just appending 2 values, but I can't seem to append it correctly.</p>

<pre><code>&lt;cfset sConsumerKey = ""&gt; &lt;!--- FromFit Bit ---&gt;
&lt;cfset sConsumerSecret = ""&gt; &lt;!--- From FitBit ---&gt;
&lt;cfset sTokenEndpoint = "http://api.fitbit.com/oauth/request_token"&gt; &lt;!--- Access Token URL ---&gt;
&lt;cfset sAuthorizationEndpoint = "http://api.fitbit.com/oauth/authorize"&gt; &lt;!--- Authorize URL ---&gt;
&lt;cfset sCallbackURL = "http://www.example.com/fitbit/callback.cfm"&gt; &lt;!--- where fitbit will redirect to after the user enters their details ---&gt;
&lt;cfset sClientToken = "#url.oauth_token#"&gt; &lt;!--- returned after an access token call ---&gt;
&lt;cfset sClientTokenSecret = "#url.oauth_verifier#"&gt; &lt;!--- returned after an access token call ---&gt;


&lt;!--- set up the required objects including signature method---&gt;
&lt;cfset oReqSigMethodSHA = CreateObject("component", "oauth.oauthsignaturemethod_hmac_sha1")&gt;
&lt;cfset oToken = CreateObject("component", "oauth.oauthtoken").createEmptyToken()&gt;
&lt;cfset oConsumer = CreateObject("component", "oauth.oauthconsumer").init(sKey = sConsumerKey, sSecret = sConsumerSecret)&gt;

&lt;cfset Parameters = structNew()&gt;
&lt;cfset parameters.oauth_token=url.oauth_token&gt;
&lt;cfset parameters.oauth_verifier=url.oauth_verifier&gt;

&lt;cfset oReq = CreateObject("component", "oauth.oauthrequest").fromConsumerAndToken(
oConsumer = oConsumer,
oToken = oToken,
sHttpMethod = "POST",
sHttpURL = sTokenEndpoint,stparameters=Parameters )&gt;

&lt;cfset oReq.signRequest(
oSignatureMethod = oReqSigMethodSHA,
oConsumer = oConsumer,
oToken = oToken)&gt;

Header:&lt;Cfdump var="#oreq.toheader()#"&gt;&lt;br&gt;


&lt;cfhttp url="http://api.fitbit.com/oauth/access_token" method="post" result="tokenresponse"&gt;
&lt;cfhttpparam type="header" name="Authorization" value="#oReq.TOHEADER()#" /&gt;
&lt;/cfhttp&gt;
</code></pre>

<p>I'm returning the following error:</p>

<pre><code>{"errors":[{"errorType":"oauth","fieldName":"oauth_access_token","message":"Invalid signature or token 'xxxxxxxxxxxxxxxxxxxxxxx' or token 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'"}],"success":false}
</code></pre>

<p>which seems to be because the verifier and token aren't showing up inside the header (or anywhere)...</p>

<p>So basically I think a good oauth callback file example would get me on track.</p>
False2014-06-10 14:29:13112601071741<api><oauth><coldfusion><fitbit>11
54
24603535Access Android Wear Fit Data<p>I'm developing an app for Android Wear on Samsung Gear Live (Google I/O Edition) where it will need access heart rate and steps count history data. I know that later this data might be accessible using <a href="https://developers.google.com/fit/" rel="noreferrer">Google Fit SDK</a>, but is it possible to read that data without using that SDK right now?</p>

<p>I would prefer to access this data without <a href="http://www.androidpolice.com/2014/07/05/how-to-android-wear-enable-debugging-take-screenshots-unlock-the-bootloader-and-root-the-lg-g-watch/" rel="noreferrer">ROOTing</a> my G Watch.</p>

<p>Here are the screenshots of the historical data that I would like to extract:</p>

<p><strong>Steps History data:</strong></p>

<p><img src="https://i.stack.imgur.com/sc1Ph.png" alt="enter image description here">
<img src="https://i.stack.imgur.com/uQDjZ.png" alt="enter image description here"></p>

<p><strong>Heart Rate History Data:</strong></p>

<p><img src="https://i.stack.imgur.com/pNMC0.png" alt="enter image description here"></p>

<p><strong>UPDATE 10/28/2014</strong></p>

<p>Google Release Google Fit SDK
Available on <a href="https://developers.google.com/fit/" rel="noreferrer">the Official website</a></p>
24624928True2014-07-07 05:26:2110677451230<java><android><wear-os><google-fit><google-fit-sdk>204
55
24752863Samsung Gear Fit Api Android<p>I have buyed a Samsung sm-r350 gear fit device. Now i want make an Android application that reads the heart rate parameters through and shows that parameter into my activity. I see the Health SDK of samsung but i must be a partener. Theres another method to retrieve that parameters?
Thanks</p>
False2014-07-15 07:59:05118881468935<android><api><bluetooth><samsung-mobile-sdk><samsung-gear-fit>11
56
24898545Oauth2 error with MapMyFitness API<p>I'm trying to use the MapMyFitness API (www.mapmyapi.com) with Ruby on Rails 3.2 and the oauth2 gem. First, my app generates the auth_url in "get_auth_url". The browser then navigates to it and a callback is returned to "mapmyfitness_callback" once authenticated. The "mapmyfitness_callback" also gets the list of "workouts" and those are displayed in the browser.</p>

<p>The problem is when the user selects a workout to download. To retrieve the selected workout, I call "get_workout". However, I'm having difficulties getting the appropriate token for the request.</p>

<p>The line below crashes:</p>

<pre><code>workout_data = access_token.get('/v7.0/workout/' + workout_id, :params =&gt; { 'field_set' =&gt; 'time_series' }, :headers =&gt; {'Api-Key' =&gt; ENV['MMF_API_KEY'], 'Authorization' =&gt; auth_token}).body
</code></pre>

<p>with: OAuth2::Error (:
{"oauth1_error":"Malformed authorization header","oauth1_error_code":"OAUTH1:UNKNOWN"}):
app/controllers/telemetry_controller.rb:60:in `get_workout'</p>

<p>The entire controller code:</p>

<pre><code>require 'oauth2'

class TelemetryController &lt; ApplicationController

def get_auth_url
auth_url = mmf_client.auth_code.authorize_url(:redirect_uri =&gt; 'http://localhost:3000/telemetry/mapmyfitness_callback')

respond_to do |format|
format.json{ render :json =&gt; {:auth_url =&gt; auth_url}.to_json }
end
end

def mapmyfitness_callback

# Get user
@code = params[:code]
token = mmf_client.auth_code.get_token(@code, :redirect_uri =&gt; 'http://localhost:3000/telemetry/mapmyfitness_callback', :headers =&gt; {'Api-Key' =&gt; ENV['MMF_API_KEY']})
mmf_user = JSON.parse(token.get('/v7.0/user/self', :headers =&gt; {'Api-Key' =&gt; ENV['MMF_API_KEY'], 'Authorization' =&gt; @code}).body)
mmf_user_id = mmf_user['id']

@auth_token = token.token

# Get workouts
mmf_workouts = JSON.parse(token.get('/v7.0/workout', :params =&gt; { 'user' =&gt; mmf_user_id }, :headers =&gt; {'Api-Key' =&gt; ENV['MMF_API_KEY'], 'Authorization' =&gt; @code}).body)

@workout_list = Array.new
mmf_workouts['_embedded']['workouts'].each do |workout|
workout_data = {:name =&gt; workout['name'],
:id =&gt; workout['_links']['self'][0]['id']}
@workout_list.push(workout_data)
end

render :layout =&gt; false

end

def get_workout

code = params[:code]
auth_token = params[:auth_token]

access_token = OAuth2::AccessToken.new(mmf_client, auth_token, {
:mode =&gt; :query,
:param_name =&gt; "oauth2_access_token",
})

puts access_token.to_yaml

# Get workout
workout_id = params[:workout_id]
workout_data = access_token.get('/v7.0/workout/' + workout_id, :params =&gt; { 'field_set' =&gt; 'time_series' }, :headers =&gt; {'Api-Key' =&gt; ENV['MMF_API_KEY'], 'Authorization' =&gt; auth_token}).body

respond_to do |format|
format.json{ render :json =&gt; {:mmf_workout_data =&gt; workout_data}.to_json }
end

end

private

def mmf_client

client = OAuth2::Client.new(
ENV['MMF_API_KEY'],
ENV['MMF_SECRET_KEY'],
:authorize_url =&gt; "https://www.mapmyfitness.com/v7.0/oauth2/authorize/",
:token_url =&gt; "https://oauth2-api.mapmyapi.com/v7.0/oauth2/access_token/",
:site =&gt; "https://oauth2-api.mapmyapi.com"
)

end

end
</code></pre>
24900102True2014-07-22 21:55:4604822666194<ruby><ruby-on-rails-3><oauth-2.0><mapmyfitness>20
57
25069685MapMyFitness API - can't get OAuth2 working in PHP<p>All,</p>

<p>I'm attempting to use MapMyFitness' API and OAuth2.</p>

<p>Here's the stripped down code I'm using (similar to code I've used successfully to connect with Strava's and RunKeeper's API):</p>

<pre><code>$mapMyRun_authorization_code = "*****";
$client_id = "*********";
$client_secret = "*************";

$url="https://oauth2-api.mapmyapi.com/v7.0/oauth2/access_token/";

$postfields = array(
"grant_type" =&gt; "authorization_code",
"client_id" =&gt; $client_id,
"client_secret" =&gt; $client_secret,
"code" =&gt; $mapMyRun_authorization_code
);

$headers = array('Api-Key: ' . $client_id);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$json = curl_exec ($ch);
$responsecode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
</code></pre>

<p>When I run this - <code>$json</code> is empty, and <code>$responsecode</code> is 400, not 200.</p>

<p>I'm obviously doing something wrong with my request, but I have no idea what...</p>
25080467True2014-07-31 22:02:42042449383<php><json><api><oauth-2.0><mapmyfitness>10
58
25134002fitbit Oauth ssl connection error<p>I've moved my server with another provider, my app was working without issue until I made the migration, now everytime I try to connect with fitbit I get this error:</p>

<pre><code> Fatal error: Uncaught exception 'OAuthException' with message 'making the request failed (SSL connect error)' in /var/www/html/includes/fitbitphp.php:188 Stack trace: #0 /var/www/html/includes/fitbitphp.php(188): OAuth-&gt;getRequestToken('https://api.fit...', 'https://gtefina...') #1 /var/www/html/fitbit.php(26): FitBitPHP-&gt;initSession('https://gtefina...') #2 {main} thrown in /var/www/html/includes/fitbitphp.php on line 188
</code></pre>

<p>I'm using this class as a wrapper <a href="https://github.com/heyitspavel/fitbitphp" rel="nofollow">https://github.com/heyitspavel/fitbitphp</a> </p>

<p>I've been looking around in several configs of the server but I ran out of options, any idea?</p>

<p>thank you.</p>
False2014-08-05 08:11:2204142987151<oauth><fitbit>10
59
25496503Fitbit for Android, automatically grab user data without OAuth each time I start app<p>I have the following code for FitBit integration into Android, it is used from this library <a href="https://github.com/manishsri01/FitbitIntegration" rel="nofollow">https://github.com/manishsri01/FitbitIntegration</a>, I can get the <code>response.getBody()</code> to show the JSON body in the webview but I would like the application to be able to automatically update the code without having to login and grab the PIN for OAuth everytime I run the app. What can I do to fix this? I would also like to parse the JSON <code>.getBody()</code> into separate string variables. How can I accomplish this?</p>

<p><strong>MainActivity</strong></p>

<pre><code>public class MainActivity extends Activity {

OAuthService service;
Token requestToken;
// Replace these with your own api key and secret
private String apiKey = "************************";
private String apiSecret = "*************************";

private String accessToken;
private String tokenSecret;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

final WebView wvAuthorize = (WebView) findViewById(R.id.wvAuthorize);
final EditText etPIN = (EditText) findViewById(R.id.etPIN);

service = new ServiceBuilder().provider(FitbitApi.class).apiKey(apiKey)
.apiSecret(apiSecret).build();

// network operation shouldn't run on main thread
new Thread(new Runnable() {
public void run() {
requestToken = service.getRequestToken();
final String authURL = service
.getAuthorizationUrl(requestToken);

// Webview nagivation should run on main thread again...
wvAuthorize.post(new Runnable() {
@Override
public void run() {
wvAuthorize.loadUrl(authURL);
}
});
}
}).start();

}

public void btnRetrieveData(View view) {
EditText etPIN = (EditText) findViewById(R.id.etPIN);
String gotPIN = etPIN.getText().toString();

final Verifier v = new Verifier(gotPIN);

// network operation shouldn't run on main thread
new Thread(new Runnable() {
public void run() {
Token accessToken = service.getAccessToken(requestToken, v);

OAuthRequest request = new OAuthRequest(Verb.GET,
"http://api.fitbit.com/1/user/-/profile.json");
service.signRequest(accessToken, request); // the access token from step
// 4
final Response response = request.send();
final TextView tvOutput = (TextView) findViewById(R.id.tvOutput);

// Visual output should run on main thread again...
tvOutput.post(new Runnable() {
@Override
public void run() {
tvOutput.setText(response.getBody());
}
});
}
}).start();
}
}
</code></pre>

<p><strong>FitBitApi</strong></p>

<pre><code>public class FitbitApi extends DefaultApi10a {

private static final String AUTHORIZE_URL = "https://www.fitbit.com/oauth/authorize?oauth_token=%s";

public String getAccessTokenEndpoint() {
return "https://api.fitbit.com/oauth/access_token";
}

public String getRequestTokenEndpoint() {
return "https://api.fitbit.com/oauth/request_token";
}

public String getAuthorizationUrl(Token token) {
return String.format(AUTHORIZE_URL, token.getToken());
}

}
</code></pre>
False2014-08-26 01:02:15114413648658<java><android><json><oauth><fitbit>142
60
25596901Withings API Status Code 2555<p>I'm trying to integrate Withings with a rails apps. I'm using an <a href="https://github.com/intridea/omniauth" rel="nofollow">Omniauth</a> provider someone wrote called <a href="https://github.com/octanner/omniauth-withings" rel="nofollow">omniauth-withings</a>. I was able to configure the provider to allow me to visit /auth/withings which redirects to the Withings authorization page. After I allow access, the browser is redirected to the callback url /auth/withings/callback. I have this routed to a controller action that attempts to get the measurement data from Withings using the <a href="https://github.com/simplificator/simplificator-withings" rel="nofollow">simplificator-withings gem</a>.</p>

<pre><code>Withings.consumer_secret = ENV['withings_app_key']
Withings.consumer_key = ENV['withings_app_secret']

auth_hash = request.env['omniauth.auth']
user_id = auth_hash.extra.raw_info.body.users.first.id

withings_user = User.authenticate(user_id, auth_hash.credentials.token, auth_hash.credentials.secret)
measurements = withings_user.measurement_groups(:device =&gt; Withings::SCALE)
</code></pre>

<p>The problem happens when I call User.authenticate(), I get this:</p>

<pre><code>An unknown error occurred - Status code: 2555
</code></pre>

<p>Is there something I'm missing here?</p>
25689952True2014-08-31 22:33:101583228068<ruby-on-rails><oauth><withings>10
61
25811475FitBit - Authenticate on behalf of user<p>In short we don't want our clients to authenticate each time that they log in to the site and want to sync their Fitbit data on our website.</p>

<p>We want them to authenticate once, and then save the tokens and use that to automatically sync the data. I can't seem to get the authorization to work. I'm using .Net.</p>

<p>Here is my code, but keeps getting 401 - Unauthorized</p>

<p>:</p>

<pre><code>string consumerKey = "KEY";
string authToken = "TOKEN";
string secrectKey = "SECRET";

string baseUrl = "http://api.fitbit.com/1/user/-/profile.xml";
string auth_nonce = DateTime.Now.Ticks.ToString();
string timestamp = ( ( Int32 )( DateTime.UtcNow.Subtract( new DateTime( 1970, 1, 1 ) ) ).TotalSeconds ).ToString();
string signingKey = string.Empty;
string authSignature = string.Empty;


string parameters = "oauth_consumer_key=" + consumerKey + "&amp;oauth_nonce=" + auth_nonce + "&amp;oauth_signature_method=HMAC-SHA1&amp;oauth_timestamp=" + timestamp + "&amp;oauth_token=" + authToken + "&amp;oauth_version=1.0";


//1. percent encode
parameters = HttpUtility.UrlEncode( parameters );

//encode baseURL
baseUrl = HttpUtility.UrlEncode( baseUrl );

//add POST
//signature base string
parameters = "GET&amp;" + baseUrl + "&amp;" + parameters;

//signing key
signingKey = secrectKey + "&amp;" + authToken;


//generate key
//base64 signature srting
authSignature = Convert.ToBase64String( Generate( signingKey, parameters ) );

//url for request
WebRequest g = HttpWebRequest.Create( "http://api.fitbit.com/1/user/-/profile.xml" );

//add headers
g.Headers.Add( HttpRequestHeader.Authorization, "OAuth realm=\"api.fitbit.com\" oauth_token=\"" + authToken + "\", oauth_consumer_key=\"" + consumerKey + "\", oauth_nonce=\"" + auth_nonce + "\", oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"" + timestamp + "\", oauth_version=\"1.0\", oauth_signature=\"" + authSignature.Replace( "=", "%3D" ) + "\"" );

//get response from server
var response = g.GetResponse();
</code></pre>

<p>Does anyone have a sample code or can see where the issue is?</p>

<p>Kind Regards</p>
25812201True2014-09-12 15:12:4717404035314<oauth><fitbit>10
62
25863757How to find Fitness API on Developer Console for Google Fit Project?<p>I am doing the steps mentioned in in <a href="https://developers.google.com/fit/android/get-started" rel="nofollow">https://developers.google.com/fit/android/get-started</a> to implement a simple fitness android app.</p>

<p>But when I want to do this:</p>

<p>Activate the Fitness API Go to the Google Developers Console. In the left sidebar, click APIs and Auth. Find the Fitness API and set its status to ON.</p>

<p>I can not find the Fitness API.</p>

<p>Where can I see this API? I could not find it on the list of APIs on <a href="https://console.developers.google.com/project/" rel="nofollow">https://console.developers.google.com/project/</a>...</p>
False2014-09-16 08:14:353832954135<android><google-fit>311
63
25875047Update google play serivices for GoogleFit<p>Hi i am trying out Google fit.when i run the app on emulator it show an dialog that you need to update the play services to run the app but when i click on update nothing happens<br>
my current version of Google play service on emulator is 5.0.53 and on installing using adb command it gives a duplicate certificate error ??
I am using Android L emulator and everything in the sdk manager is updated</p>
26025949True2014-09-16 17:30:4401064008796<android><google-play-services><google-fit>12
64
25907328HealthKit HKSampleQuery Heart rate readings<p>I'm trying to get heart rate readings through the healthkit store using HKSampleQuery, but I keep getting count/s. Is there anyway I can get it by count/minute? </p>
False2014-09-18 08:04:1408964053522<ios8><healthkit><hksamplequery>11
65
26094459How to scan for BLE device using Android Fit SDK? I'm getting and interface mismatch error<p>I followed the code from the sample (<a href="https://developers.google.com/fit/android/ble-sensors" rel="nofollow">https://developers.google.com/fit/android/ble-sensors</a>) but I get the following error.</p>

<pre><code>private void buildFitnessClient() {
// Create the Google API Client
mClient = new GoogleApiClient.Builder(this)
.addApi(Fitness.API)
.addScope(FitnessScopes.SCOPE_ACTIVITY_READ)
.addScope(FitnessScopes.SCOPE_BODY_READ)
.addScope(FitnessScopes.SCOPE_LOCATION_READ)
.addConnectionCallbacks(
new GoogleApiClient.ConnectionCallbacks() {
@Override
public void onConnected(Bundle bundle) {
Log.i(TAG, "Connected!!!");
buildBle(); // Scan for BLE Devices.
}

@Override
public void onConnectionSuspended(int i) {
// ..
}
}
)
.addOnConnectionFailedListener(
new GoogleApiClient.OnConnectionFailedListener() {
// ..
}
)
.build();
}

private void buildBle() {
BleScanCallback callback = new BleScanCallback() {
@Override
public void onDeviceFound(BleDevice device) {
ClaimBleDeviceRequest request = new ClaimBleDeviceRequest.Builder()
.setDevice(device)
.build();
PendingResult&lt;Status&gt; pendingResult =
Fitness.BleApi.claimBleDevice(mClient, request);
}
@Override
public void onScanStopped() {
// ..
}
};

StartBleScanRequest request = new StartBleScanRequest.Builder()
.setDataTypes(DataTypes.HEART_RATE_BPM)
.setBleScanCallback(callback)
.build();

PendingResult&lt;Status&gt; pendingResult =
Fitness.BleApi.startBleScan(mClient, request);

}

@Override
protected void onCreate(Bundle savedInstanceState) {
// ..
buildFitnessClient();
}
</code></pre>

<p>Calling <code>buildBle()</code> method gives the following error.</p>

<pre><code>09-29 12:38:27.777: W/Parcel(5900): **** enforceInterface() expected 'com.google.android.gms.fitness.ble.IBleScanCallback' but read 'com.google.android.gms.fitness.request.IBleScanCallback'
09-29 12:38:27.777: W/Binder(5900): Caught a RuntimeException from the binder stub implementation.
09-29 12:38:27.777: W/Binder(5900): java.lang.SecurityException: Binder invocation to an incorrect interface
09-29 12:38:27.777: W/Binder(5900): at android.os.Parcel.nativeEnforceInterface(Native Method)
09-29 12:38:27.777: W/Binder(5900): at android.os.Parcel.enforceInterface(Parcel.java:453)
09-29 12:38:27.777: W/Binder(5900): at com.google.android.gms.fitness.ble.d$a.onTransact(Unknown Source)
09-29 12:38:27.777: W/Binder(5900): at android.os.Binder.execTransact(Binder.java:404)
09-29 12:38:28.794: W/Parcel(5900): **** enforceInterface() expected 'com.google.android.gms.fitness.ble.IBleScanCallback' but read 'com.google.android.gms.fitness.request.IBleScanCallback'
09-29 12:38:28.794: W/Binder(5900): Caught a RuntimeException from the binder stub implementation.
09-29 12:38:28.794: W/Binder(5900): java.lang.SecurityException: Binder invocation to an incorrect interface
09-29 12:38:28.794: W/Binder(5900): at android.os.Parcel.nativeEnforceInterface(Native Method)
09-29 12:38:28.794: W/Binder(5900): at android.os.Parcel.enforceInterface(Parcel.java:453)
09-29 12:38:28.794: W/Binder(5900): at com.google.android.gms.fitness.ble.d$a.onTransact(Unknown Source)
09-29 12:38:28.794: W/Binder(5900): at android.os.Binder.execTransact(Binder.java:404)
09-29 12:38:29.801: W/Parcel(5900): **** enforceInterface() expected 'com.google.android.gms.fitness.ble.IBleScanCallback' but read 'com.google.android.gms.fitness.request.IBleScanCallback'
09-29 12:38:29.802: W/Binder(5900): Caught a RuntimeException from the binder stub implementation.
09-29 12:38:29.802: W/Binder(5900): java.lang.SecurityException: Binder invocation to an incorrect interface
09-29 12:38:29.802: W/Binder(5900): at android.os.Parcel.nativeEnforceInterface(Native Method)
09-29 12:38:29.802: W/Binder(5900): at android.os.Parcel.enforceInterface(Parcel.java:453)
09-29 12:38:29.802: W/Binder(5900): at com.google.android.gms.fitness.ble.d$a.onTransact(Unknown Source)
09-29 12:38:29.802: W/Binder(5900): at android.os.Binder.execTransact(Binder.java:404)
09-29 12:38:31.816: W/Parcel(5900): **** enforceInterface() expected 'com.google.android.gms.fitness.ble.IBleScanCallback' but read 'com.google.android.gms.fitness.request.IBleScanCallback'
09-29 12:38:31.817: W/Binder(5900): Caught a RuntimeException from the binder stub implementation.
09-29 12:38:31.817: W/Binder(5900): java.lang.SecurityException: Binder invocation to an incorrect interface
09-29 12:38:31.817: W/Binder(5900): at android.os.Parcel.nativeEnforceInterface(Native Method)
09-29 12:38:31.817: W/Binder(5900): at android.os.Parcel.enforceInterface(Parcel.java:453)
09-29 12:38:31.817: W/Binder(5900): at com.google.android.gms.fitness.ble.d$a.onTransact(Unknown Source)
09-29 12:38:31.817: W/Binder(5900): at android.os.Binder.execTransact(Binder.java:404)
09-29 12:38:32.845: W/Parcel(5900): **** enforceInterface() expected 'com.google.android.gms.fitness.ble.IBleScanCallback' but read 'com.google.android.gms.fitness.request.IBleScanCallback'
09-29 12:38:32.845: W/Binder(5900): Caught a RuntimeException from the binder stub implementation.
09-29 12:38:32.845: W/Binder(5900): java.lang.SecurityException: Binder invocation to an incorrect interface
09-29 12:38:32.845: W/Binder(5900): at android.os.Parcel.nativeEnforceInterface(Native Method)
09-29 12:38:32.845: W/Binder(5900): at android.os.Parcel.enforceInterface(Parcel.java:453)
09-29 12:38:32.845: W/Binder(5900): at com.google.android.gms.fitness.ble.d$a.onTransact(Unknown Source)
09-29 12:38:32.845: W/Binder(5900): at android.os.Binder.execTransact(Binder.java:404)
09-29 12:38:33.842: W/Parcel(5900): **** enforceInterface() expected 'com.google.android.gms.fitness.ble.IBleScanCallback' but read 'com.google.android.gms.fitness.request.IBleScanCallback'
09-29 12:38:33.854: W/Binder(5900): Caught a RuntimeException from the binder stub implementation.
09-29 12:38:33.854: W/Binder(5900): java.lang.SecurityException: Binder invocation to an incorrect interface
09-29 12:38:33.854: W/Binder(5900): at android.os.Parcel.nativeEnforceInterface(Native Method)
09-29 12:38:33.854: W/Binder(5900): at android.os.Parcel.enforceInterface(Parcel.java:453)
09-29 12:38:33.854: W/Binder(5900): at com.google.android.gms.fitness.ble.d$a.onTransact(Unknown Source)
09-29 12:38:33.854: W/Binder(5900): at android.os.Binder.execTransact(Binder.java:404)
09-29 12:38:34.847: W/Parcel(5900): **** enforceInterface() expected 'com.google.android.gms.fitness.ble.IBleScanCallback' but read 'com.google.android.gms.fitness.request.IBleScanCallback'
09-29 12:38:34.848: W/Binder(5900): Caught a RuntimeException from the binder stub implementation.
09-29 12:38:34.848: W/Binder(5900): java.lang.SecurityException: Binder invocation to an incorrect interface
09-29 12:38:34.848: W/Binder(5900): at android.os.Parcel.nativeEnforceInterface(Native Method)
09-29 12:38:34.848: W/Binder(5900): at android.os.Parcel.enforceInterface(Parcel.java:453)
09-29 12:38:34.848: W/Binder(5900): at com.google.android.gms.fitness.ble.d$a.onTransact(Unknown Source)
09-29 12:38:34.848: W/Binder(5900): at android.os.Binder.execTransact(Binder.java:404)
09-29 12:38:35.849: W/Parcel(5900): **** enforceInterface() expected 'com.google.android.gms.fitness.ble.IBleScanCallback' but read 'com.google.android.gms.fitness.request.IBleScanCallback'
09-29 12:38:35.856: W/Binder(5900): Caught a RuntimeException from the binder stub implementation.
09-29 12:38:35.856: W/Binder(5900): java.lang.SecurityException: Binder invocation to an incorrect interface
09-29 12:38:35.856: W/Binder(5900): at android.os.Parcel.nativeEnforceInterface(Native Method)
09-29 12:38:35.856: W/Binder(5900): at android.os.Parcel.enforceInterface(Parcel.java:453)
09-29 12:38:35.856: W/Binder(5900): at com.google.android.gms.fitness.ble.d$a.onTransact(Unknown Source)
09-29 12:38:35.856: W/Binder(5900): at android.os.Binder.execTransact(Binder.java:404)
09-29 12:38:36.275: W/Parcel(5900): **** enforceInterface() expected 'com.google.android.gms.fitness.ble.IBleScanCallback' but read 'com.google.android.gms.fitness.request.IBleScanCallback'
09-29 12:38:36.276: W/Binder(5900): Caught a RuntimeException from the binder stub implementation.
09-29 12:38:36.276: W/Binder(5900): java.lang.SecurityException: Binder invocation to an incorrect interface
09-29 12:38:36.276: W/Binder(5900): at android.os.Parcel.nativeEnforceInterface(Native Method)
09-29 12:38:36.276: W/Binder(5900): at android.os.Parcel.enforceInterface(Parcel.java:453)
09-29 12:38:36.276: W/Binder(5900): at com.google.android.gms.fitness.ble.d$a.onTransact(Unknown Source)
09-29 12:38:36.276: W/Binder(5900): at android.os.Binder.execTransact(Binder.java:404)
</code></pre>

<p>Please help. Thanks.</p>
False2014-09-29 07:19:0121413user235273<android><bluetooth-lowenergy><google-fit><google-fit-sdk>300
66
26150204How can i delete multiple objects from HKHealthStore?<p>I know there are these methods, according to <a href="https://developer.apple.com/library/ios/documentation/HealthKit/Reference/HKHealthStore_Class/index.html#//apple_ref/occ/instm/HKHealthStore/saveObjects:withCompletion:" rel="nofollow">Apple HealthKit Docs</a></p>

<pre><code>Working with HealthKit Objects

deleteObject:withCompletion:
saveObject:withCompletion:
saveObjects:withCompletion:
</code></pre>

<p>I'm looking for something like this:
<code>deleteObjects:withCompletion:</code> </p>

<p>Or a way to delete multiple objects from <code>HKHealthStore</code> without calling <code>deleteObject:withCompletion:</code> multiple times.</p>
26249880True2014-10-01 20:39:290403760275<ios><ios8><healthkit><hkhealthstore>11
67
26209327HKSampleQuery for HKWorkout<p>I have a problem to query <code>HKWorkout</code>.</p>

<p>Below is the code I use to save <code>HKWorkout</code> and <code>HKQuantitySample</code>.</p>

<pre><code>func workout(#distance:Double, start: NSTimeInterval, paused:NSTimeInterval, resume:NSTimeInterval, end:NSTimeInterval, calory:Double) -&gt; HKWorkout {

var event1_ = HKWorkoutEvent(type: HKWorkoutEventType.Pause, date: self.minutesBeforeNow(paused))
var event2_ = HKWorkoutEvent(type: HKWorkoutEventType.Resume, date: self.minutesBeforeNow(resume))
var calories_ = HKQuantity(unit: HKUnit.calorieUnit(), doubleValue: calory)
var distance_ = HKQuantity(unit: HKUnit.meterUnit(), doubleValue: distance)
var meta_ = [
"TITLE":"WORKOUT_TEST",
"TEAM":"TEAM WAG",
"ID":"\(arc4random()%999)"
]

var workout_ = HKWorkout(
activityType: HKWorkoutActivityType.Cycling,
startDate: self.minutesBeforeNow(start),
endDate: self.minutesBeforeNow(end),
workoutEvents: [event1_, event2_],
totalEnergyBurned: calories_,
totalDistance: distance_,
metadata: meta_)

return workout_
}

func quantity(#distance:Double, start:NSTimeInterval, end:NSTimeInterval) -&gt; HKQuantitySample {

var meta_ = [
"TITLE":"QUANTITY_SAMPLE_TEST",
"ID":"\(arc4random()%99)"]
var sample_ = HKQuantitySample(
type: HKObjectType.quantityTypeForIdentifier(HKQuantityTypeIdentifierDistanceCycling),
quantity: HKQuantity(unit: HKUnit.meterUnit(), doubleValue: distance),
startDate: self.minutesBeforeNow(start),
endDate: self.minutesBeforeNow(end),
metadata:meta_)

return sample_
}

func minutesBeforeNow(min:NSTimeInterval) -&gt; NSDate {
return NSDate().dateByAddingTimeInterval(-60 * min)
}
</code></pre>

<p>I save with the codes and works fine. Even I can query with HKSampleQuery like</p>

<pre><code>var predicate_ = HKQuery.predicateForSamplesWithStartDate(self.minutesBeforeNow(120), endDate: self.minutesBeforeNow(10), options: HKQueryOptions.None)
var query_ = HKSampleQuery(sampleType: HKSampleType.quantityTypeForIdentifier(HKQuantityTypeIdentifierDistanceCycling),
predicate: predicate_,
limit: 10,
sortDescriptors: nil) { (let sampleQuery, let samples, let error) -&gt; Void in

BKLog("")
for sample in samples as [HKQuantitySample]
{
var meter_ = sample.quantity.doubleValueForUnit(HKUnit.meterUnit())
var km_ = meter_ / 1000
BKLog("\(sample.metadata?.description), \(km_))")
}
};
</code></pre>

<p>However when I tried to query with HKWorkoutType, I couldn't get anything.</p>

<pre><code>var query_ = HKSampleQuery(
sampleType: HKSampleType.workoutType(),
predicate: nil,
limit: 10,
sortDescriptors: nil) { (let query, let objects, let error) -&gt; Void in

BKLog("") // 1

if(error != nil)
{
BKLog("ERROR : \(error.localizedDescription)") // 2
return
}
else
{
BKLog("WORKOUST : \(objects.count)") // 3
}


for workout in objects {
}
}
</code></pre>

<p>The weird thing here is I got no log with the completion block. No log from 1, 2, 3 commented log.</p>

<p>When I use <code>class func predicateForObjectsFromWorkout(workout: HKWorkout!) -&gt; NSPredicate!</code>, it worked as I expected.</p>

<p>Why can't I get anything with <code>HKWorkoutType()</code> query?</p>

<p><em>BKLog is just a formed log function</em></p>
26731559True2014-10-06 02:30:04219041215715<swift><healthkit><hksamplequery>11
68
26299185How to group HKStatistics by hour?<p>I'm trying to extract step data from HealthKit.</p>

<p>I want to create a summary of step data grouped by hour. Currently, I can extract all of the samples of data between a date range provided by <code>NSPredicate</code> with <code>HKSampleQuery</code>. I could also get a sum of the step count between a date range with <code>HKStatisticsQuery</code>.</p>

<p>What I am asking is if there is a way to sum group the samples or statistics by hour. In SQL I would write something like this:</p>

<p><code>SELECT HOUR(date), SUM(steps) FROM healthkit WHERE date BETWEEN 'blah' AND 'blah' GROUP BY 1;</code></p>

<p>Am I seriously going to have to query HKStatistics 24 x 31 times to write the last month of step data grouped by hour? Because that seems rather inefficient, especially with how the <code>resultsHandler</code> is implemented.</p>
26337564True2014-10-10 12:12:28231241953652<ios><ios8><healthkit><hksamplequery>101
69
26348128Getting most recent BMI value from HKHealthStore<p>I want to get the users most recent BMI reading from my instance of HKHealthStore. As of right now I am doing it as follows but it doesn't seem right. Is there a way to get an actual numerical value for BMI instead of a countUnit (HKUnit)?</p>

<pre><code>HKQuantityType *bodyMassIndexType = [HKObjectType quantityTypeForIdentifier:HKQuantityTypeIdentifierBodyMassIndex];

HKSampleQuery *bmiSampleQuery = [[HKSampleQuery alloc] initWithSampleType:bodyMassIndexType predicate:nil limit:1 sortDescriptors:nil resultsHandler:^(HKSampleQuery *query, NSArray *results, NSError *error) {

if (results.count == 0)
{
//No results
}
else
{
if (!error)
{
NSString *bmiString = [NSString stringWithFormat:@"%@", [[results firstObject] quantity]];
NSString *parsedBMIString = [bmiString stringByReplacingOccurrencesOfString:@" count" withString:@""];
NSLog(@"%f", [parsedBMIString floatValue]);
}
}
}];

[self.store executeQuery:bmiSampleQuery];
</code></pre>
27595597True2014-10-13 20:12:0414023434098<ios><healthkit><hkhealthstore><hksamplequery>10
70
26361874Unable to Connect To GoogleFit<p>I am trying to connect to Googlefit but i am getting a strange error code as below</p>

<p><strong>E/GooglePlayServicesUtil﹕ Unexpected error code 5005</strong></p>

<p>Does anybody have any idea about this.Thanks In advance </p>
28868460True2014-10-14 13:19:00228704008796<google-play-services><google-fit><google-fit-sdk>34
71
26390192GoogleFit Sample Not Working<p>I am trying the BasicHistory Sample whis stores a data and then read it but in my case the code get stuck at the insert call.await call does not return anything i have tried using the asynchronous way also,here is the code</p>

<pre><code>com.google.android.gms.common.api.Status insertStatus =
Fitness.HistoryApi.insert(mClient, insertRequest).await(1, TimeUnit.MINUTES);
</code></pre>
False2014-10-15 19:08:0209464008796<android><google-play-services><google-fit>21
72
26517181Withings Web API call signature issue?<p>So I generate URL same as what we get from withings developer site.<br/>
However I get {“status”:342}.<br/>
I am using java and using below for oauth nonce, timestamp and oauth signature<br/></p>

<p>But when I replace these 3 values from what I get from withings website, it works just fine.
I dont understand what I am doing wrong. Any help is appreciated</p>

<ul>
<li>String.valueOf(Math.random()) for nonce</li>
<li>System.currentTimeMillis() / 1000L – timestamp</li>
<li><p>SecretKeySpec to generate signature using below</p></li>
<li><p>GET<br/></p></li>
<li><a href="http://wbsapi.withings.net/measure?action=getmeas&amp;userid=2---0" rel="nofollow">http://wbsapi.withings.net/measure?action=getmeas&amp;userid=2---0</a><br/></li>
<li>oauth_consumer_key=00000000061e0bf7f7b109903040dc------&amp;oauth_nonce=0.4509674797693397&amp;oauth_signature_method=HMAC-SHA1&amp;oauth_timestamp=1414031787&amp;oauth_token=000000-3b5f9e4704d270551e69b45db31de4ec88b4ebe03&amp;oauth_version=1.0</li>
</ul>
False2014-10-22 21:11:2716391729803<java><withings>10
73
26582199Getting error in google fit "Connection failed. Cause: ConnectionResult{statusCode=unknown status code 5005, resolution=null}"<p>I have tried to develop application using google fit. I follow <a href="https://developers.google.com/fit/android/get-started" rel="nofollow">This</a> link </p>

<p>When i try to run that application i got the following error </p>

<p>10-27 11:55:19.966: I/Google Fit(6016): Connection failed. Cause: ConnectionResult{statusCode=unknown status code 5005, resolution=null}</p>

<p>10-27 11:55:19.966: E/GooglePlayServicesUtil(6016): Unexpected error code 5005</p>
26584840True2014-10-27 06:31:32445051829753<google-api><google-play-services><android-5.0-lollipop><google-fit>20
74
26598794Can I use Fitbit Api to get the acceleration data of my Fitbit?<p>I'm trying to use data from my Fitbit to catch my hand movement. </p>

<p>Then I find the Fitbit Api here: <a href="https://wiki.fitbit.com/display/API/Fitbit+Resource+Access+API" rel="nofollow">https://wiki.fitbit.com/display/API/Fitbit+Resource+Access+API</a></p>

<p>In the collection resources part, it seems that I can only get some data like body measurements, weight, recent activities, friends, etc. </p>

<p>So, my question is, does Fitbit provide any API to help me get its realtime accelerometer data and Gyroscope data? </p>
False2014-10-27 23:53:06612374187868<java><api><accelerometer><sensors><fitbit>10
75
26649531How to get the activity name from activity code in google fit<p>I am working with google fit . I have activities int value, I want to get the name of the activity from int value.</p>
26650164True2014-10-30 09:40:1324271829753<google-fit><google-fit-sdk>10
76
26669042How to set listener for only walking activities in Google fit api<p>I need to add sensor listener for Walking activity in android google fit. can any one guide me in right way.</p>
False2014-10-31 06:54:5912141829753<google-play-services><google-fit><google-fit-sdk>10
77
26670836Google fit data is different from device to device with same account<p>I have created a Google Fit application to read/write data from Google Fit. I have two devices linked to the same account, but I cannot see the data added from one device to another.</p>

<p>How is this fixed?</p>
26670837True2014-10-31 09:03:40614741829753<google-play-services><google-fit><google-fit-sdk>10
78
26694241Samsung CUP how do I make the gear fit vibrate<p>How do I make the gear fit vibrate continously?</p>

<p>I used someone else's sample code and got this far</p>

<pre><code>public class GearFitSDKSample extends ScupDialog {

MyActivity activity;

public GearFitSDKSample(Context context) {
super(context);
activity = (MyActivity) context;

// TODO Auto-generated constructor stub
}

@Override
protected void onCreate() {
super.onCreate();
final ScupLabel label = new ScupLabel(this);
label.setWidth(ScupLabel.FILL_DIALOG);
label.setHeight(ScupLabel.FILL_DIALOG);
label.setText("Hello XDA Developers!");
label.show();
setBackPressedListener(new BackPressedListener() {
@Override
public void onBackPressed(ScupDialog arg0) {
finish();
}
});
}

public Integer x;

{
x = 50;
}

public Integer signo = 1;
}
</code></pre>

<p>I'm using android studio and having a hard time getting anything to post...</p>

<p>The goal i'm trying to achieve is use the Samsung CUP SDK to cause a long , or continuous vibration pattern on the gear fit based on some conditions such as possibly, an alarm going off which would be set in the app or outside it then have the app called through an intent (I would expose this intent to other apps publically I guess)</p>

<p>Anyways I just need some help getting the part where the gear fit vibrates with a vibration pattern (of my choice).</p>
False2014-11-01 23:11:2109683675013<android><samsung-gear-fit>10
79
26750461How is the Fitbit OAuth authorization remembered/saved in this code?<p>I found this code that syncs Fitbit data to a Google spreadsheet. I would like to adapt it a bit, but i am stuck trying to figure out how the authorization is saved. I think my confusion is a result of a lack of understanding how OAuth works.</p>

<p>Here is the code: <a href="https://github.com/qslabs/FitbitDailyData/blob/master/FitbitDailyData.gs" rel="nofollow">https://github.com/qslabs/FitbitDailyData/blob/master/FitbitDailyData.gs</a></p>

<p>It lets you configure the keys, and then when you authorize the first time in a spreadsheet, it pops up an authorization window. The next time it doesn't need the authorization window. I understand it won't ask for authorization if it's already authorized, but how does it remember which account authorized it? I don't see it saving any access tokens anywhere. Is it just automatic somehow when using Google script OAuth library? </p>

<p>Thank you</p>
False2014-11-05 05:42:1501471032372<oauth><google-apps-script><google-sheets><fitbit>10
80
26805399Fitbit oauth registration<p>My app links to the FitBit API. The users (via my portal) give my app access permission via FitBit's OAUTH API to grab data for the users. All works fine EXCEPT many of my users use a shared computer. FitBit is remembering credentials from the previous user and not prompting for a password when they request permission for access. The end result is that I get the previous user's fitbit associated with the current user. Is there a way to force the actual fitbit login screen (by erasing cookies?) instead of having fitbit remember them? Does anyone know how to do this? I'm using php with the net.manuellemos.oauth oauth package if that matters.</p>
26844696True2014-11-07 16:10:320439300<php><oauth><fitbit>101
81
26822432Why is my wearable not listed as DataSource in Google Fit API?<p>I'm trying to access the heart rate monitor of a Samsung Gear Live watch. The watch is paired with a 4.4.4 handset and works correctly. I'm following the <a href="https://developers.google.com/fit/android/samples" rel="nofollow noreferrer">official BasicSensorsApi sample</a>.</p>

<p>I can successfully connect to Google Play Services with the following scope:</p>

<pre><code>addScope(new Scope(Scopes.FITNESS_LOCATION_READ_WRITE))
.addScope(new Scope(Scopes.FITNESS_ACTIVITY_READ_WRITE))
.addScope(new Scope(Scopes.FITNESS_BODY_READ_WRITE))
</code></pre>

<p>But then, when I want to list all available heart rate monitors, I receive an empty list of <code>DataSource</code>:</p>

<pre><code>private void findFitnessDataSources() {
Fitness.SensorsApi.findDataSources(mGoogleApiClient, new DataSourcesRequest.Builder()
.setDataTypes(
DataType.TYPE_HEART_RATE_BPM)// At least one datatype must be specified.
.setDataSourceTypes(
DataSource.TYPE_RAW)// Specify whether data type is raw or derived.
.build())
.setResultCallback(new ResultCallback&lt;DataSourcesResult&gt;() {
@Override
public void onResult(DataSourcesResult dataSourcesResult) {
for (DataSource dataSource : dataSourcesResult.getDataSources()) {
if (dataSource.getDataType().equals(DataType.TYPE_HEART_RATE_BPM)
&amp;&amp; mListener == null) {
registerFitnessDataListener(dataSource,
DataType.TYPE_HEART_RATE_BPM);
}
}
}
});
</code></pre>

<p>If I change the <code>DataType</code> to, for example, <code>TYPE_STEP_COUNT_CUMULATIVE</code> or <code>TYPE_LOCATION_SAMPLE</code>, the list will contain my phone, which seems logical.</p>

<p>Why is the watch not listed as an available <code>DataSource</code> then?</p>

<p>Please note:
This is not a duplicate of:</p>

<ol>
<li><a href="https://stackoverflow.com/questions/24664217/get-heart-rate-from-sensor-samsung-gear-live">Get Heart Rate from “Sensor” Samsung Gear Live</a></li>
<li><a href="https://stackoverflow.com/questions/26489281/how-to-access-heart-rate-sensor-in-android-wearable">How to access heart rate sensor in Android Wearable?</a></li>
</ol>

<p>because I want to access the heart beat data through the recently released Google Fit API.</p>

<p>I don't think enabling debug mode on the watch is necessary, but I've tried that. Also, I don't think adding <code>BODY_SENSORS</code> permission is necessary, because the whole process is managed by Google Fit API anyway, but I've tried that too with no luck.</p>
26823356True2014-11-08 21:44:3792421953682<android><wear-os><heartbeat><google-fit>13
82
26894932How to properly retrieve package name of the app that inserted data to Google Fit?<p>I have a following code I am using to retrieve a list of user's activities from Google Fit:</p>

<pre><code>public void getActivitiesData(Date from, Date till) {
DataReadRequest readRequest = new DataReadRequest.Builder()
.aggregate(DataType.TYPE_ACTIVITY_SEGMENT, DataType.AGGREGATE_ACTIVITY_SUMMARY)
.bucketByTime(1, TimeUnit.DAYS)
.setTimeRange(from.getTime(), till.getTime(), TimeUnit.MILLISECONDS)
.build();

Fitness.HistoryApi.readData(apiClient, readRequest).setResultCallback(new com.google.android.gms.common.api.ResultCallback&lt;DataReadResult&gt;() {
@Override
public void onResult(DataReadResult dataReadResult) {
Status status = dataReadResult.getStatus();
if (status.isSuccess()) {

for (Bucket bucket : dataReadResult.getBuckets()) {
if (!bucket.getDataSets().isEmpty()) {
DataSet dataSet = bucket.getDataSets().get(0);
String sourceAppPackageName = getSourceAppPackageNameFromDataSet(dataSet);
for (DataPoint dp : dataSet.getDataPoints()) {
for (Field field : dp.getDataType().getFields()) {
String fieldName = field.getName();
if (fieldName != null &amp;&amp; fieldName.equals("activity")) {
String type = FitnessActivities.getValue(dp);
Date from = new Date(dp.getStartTime(TimeUnit.MILLISECONDS));
Date till = new Date(dp.getEndTime(TimeUnit.MILLISECONDS));

// store retrieved values to the data object, omitted
}
}
}
}
}
}
}
});
}

private static String getSourceAppPackageNameFromDataSet(DataSet dataSet) {
String result = null;

if (dataSet.getDataSource() != null) {
result = dataSet.getDataSource().getAppPackageName();
}

return result;
}
</code></pre>

<p>To insert activities into Google Fit, I've used the Google Fit app and Runkeeper (right now, these apps seem to be only ones that are integrated with Fit).</p>

<p>My code retrieves these activities as expected, however, for each activity, my <code>getSourceAppPackageNameFromDataSet()</code> method returns <code>"com.google.android.gms"</code> as a package name. As per <a href="https://developers.google.com/fit/android/data-attribution" rel="noreferrer">Data Attribution section in Google Fit documentation</a>, I would expect the method to return a package name of either Runkeeper or Google Fit, but this does not happen.</p>

<p>Am I doing something horribly wrong, or is this a bug in Google Fit?</p>
34409909True2014-11-12 19:26:3781147418872<android><google-play-services><google-fit><google-fit-sdk>112
83
26929699Add/Read weight and height in GoogleFit? Android<p>By Google, I got this code to insert <code>DataType.TYPE_STEP_COUNT_DELTA</code>. but how to insert <code>TYPE_HEIGHT AND TYPE_WEIGHT</code> using Android </p>

<pre><code> com.google.android.gms.common.api.Status insertStatus =
Fitness.HistoryApi.insertData(mClient, dataSet)
.await(1, TimeUnit.MINUTES);
</code></pre>
False2014-11-14 12:08:42645262106348<android><google-fit>302
84
26959565Exclude own samples from healthkit queries<p>I'm writing an app that amongst other things, reads weight samples from HealthKit.<br/>
I'm also writing samples.<br/>
I'm trying to read the latest sample that isn't mine:<br/></p>

<pre><code>NSPredicate* non_fdct = [NSCompoundPredicate notPredicateWithSubpredicate:[HKQuery predicateForObjectsFromSource:[HKSource defaultSource]]];
NSSortDescriptor *last = [[NSSortDescriptor alloc] initWithKey:HKSampleSortIdentifierEndDate ascending:NO];
HKSampleQuery* query = [[HKSampleQuery alloc] initWithSampleType:[HKQuantityType quantityTypeForIdentifier:HKQuantityTypeIdentifierBodyMass] predicate:non_fdct limit:1 sortDescriptors:@[last] resultsHandler:^(HKSampleQuery *query, NSArray *results, NSError *error) { ... };
</code></pre>

<p>But I'm getting my own samples if they are the latest samples.<br/>
Any idea?</p>
False2014-11-16 16:58:3914671610530<ios><objective-c><healthkit><hksamplequery>101
85
27011080Using OAuth.io iOS library to log into FitBit snag<p>following OAuth.io simple two lines</p>

<pre><code>OAuthIOModal *oauthioModal = [[OAuthIOModal alloc] initWithKey:PublicKey delegate:self];
[oauthioModal showWithProvider:@"fitbit"];
</code></pre>

<p>throws up the web view, with the proper FitBit page.</p>

<p>YAY</p>

<p>I fill in the email &amp; password, tap "allow".</p>

<p>I then get the "green check" with the happy message "Authorized"..</p>

<p>--THEN-- the FitBit page says "please return to [The App] and enter the following PIN when requested".</p>

<p>problem 1) We're in [The App].. we never left it.. we're in a web view. there's no returning to the app</p>

<p>problem 2) Copying a PIN? that's really inconvenient.. especially on a mobile device. why can't it just be returned in a callback in the http param? Like Facebook SDK, like Twitter, like Instagram?</p>

<p>problem 3) because of 1), there is no button, no callback execution, the only thing that can be pressed is the X in the OAuth.io view controller</p>

<p>problem 4) the didFailWithOAuthIOError: delegate method gets called with 'user cancelled'.</p>

<p>it seems like something really simple is missing, but everything seems correct up until the "show with provider" call.</p>

<p>please help</p>
False2014-11-19 07:14:2402804084695<ios><fitbit><oauth.io>10
86
27038363Fitbit Java Https support<p>Does Fitbit for Java actually support https yet?</p>

<p>Previously, the code worked. Now the code returns an error requesting that I use HTTPS. </p>

<pre><code>{"errors":[{"errorType":"request","fieldName":"n/a","message":"This request should use https protocol."}],"success":false}

at com.fitbit.api.client.FitbitApiClientAgent.getUserInfo(FitbitApiClientAgent.java:2063)
at com.fitbit.api.client.FitbitApiClientAgent.getUserInfo(FitbitApiClientAgent.java:2039)
at Auth.populateDataGetters(Auth.java:112)
at Auth.&lt;init&gt;(Auth.java:106)
at Driver.main(Driver.java:18)
Caused by: com.fitbit.api.FitbitAPIException: 400: The request was invalid. An accompanying error message will explain why.
</code></pre>

<p>As far as I know, OAuth seems to work fine.</p>

<p>The only URL I have in my code that isn't https is:</p>

<pre><code>String API_BASE_URL = "api.fitbit.com";
</code></pre>

<p>When I change this string to "<a href="https://api.fitbit.com" rel="nofollow">https://api.fitbit.com</a>", I get the error</p>

<pre><code>Caused by: com.fitbit.api.FitbitAPIException: https
at com.fitbit.api.client.http.HttpClient.httpRequest(HttpClient.java:473)
at com.fitbit.api.client.http.HttpClient.get(HttpClient.java:398)
at com.fitbit.api.client.FitbitApiClientAgent.httpGet(FitbitApiClientAgent.java:2784)
at com.fitbit.api.client.FitbitApiClientAgent.httpGet(FitbitApiClientAgent.java:2734)
at com.fitbit.api.client.FitbitApiClientAgent.getUserInfo(FitbitApiClientAgent.java:2059)
... 4 more
Caused by: java.net.UnknownHostException: https
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:178)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:579)
at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
at sun.net.www.http.HttpClient.&lt;init&gt;(HttpClient.java:211)
at sun.net.www.http.HttpClient.New(HttpClient.java:308)
at sun.net.www.http.HttpClient.New(HttpClient.java:326)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:996)
</code></pre>

<p>The stable Java Fitbit library has not been updated in 2 years and the Java example code isn't very helpful for a standalone application.</p>
False2014-11-20 11:23:2709824274025<java><https><fitbit>20
87
27048904How to pass a instance of a google api connected client<p>I am suffering from a bit of confusion around the google fit and google + api. When my app is first opened the user is asked to sign in with google + etc and then, if they are logged in, are transfered via intent to my home class. This class sets up some fragments for the user profile area.</p>

<p>The bit I am confused about is how to recall this client from a fragment later on? As far as I am aware you cannot transfer the client instace in a bundle? Is it a case that I would have to run my who login bit again to retrieve the client, obviously as they have already approved my app it should just happen automatically or am I missing something?</p>
27049445True2014-11-20 20:26:3409551136734<android-intent><android-fragments><bundle><google-fit>20
88
27050232Error in retrieving google fit steps<p>I am using this code to try and retrieve steps made in the last 14 hours.</p>

<pre><code>YApp myApp = (mYApp) ctx;
mGoogleApiClient = myApp.getMyUser();
mGoogleApiClient.reconnect();


Calendar cal = Calendar.getInstance();
Date now = new Date();
cal.setTime(now);
long endTime = cal.getTimeInMillis();
cal.add(Calendar.HOUR_OF_DAY, -16);
long startTime = cal.getTimeInMillis();

PendingResult&lt;DataReadResult&gt; pendingResult =
Fitness.HistoryApi.readData(mGoogleApiClient, new DataReadRequest.Builder()
.aggregate(DataType.TYPE_STEP_COUNT_DELTA, DataType.AGGREGATE_STEP_COUNT_DELTA)
.bucketByTime(1, TimeUnit.DAYS)
.setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS)
.build());

DataReadResult dataReadResult = pendingResult.await();



DataSet ds = dataReadResult.getDataSet(DataType.AGGREGATE_STEP_COUNT_DELTA);
</code></pre>

<p>My datareadresult returns success but when I try and read the results into the dataset I get this error</p>

<pre><code>java.lang.IllegalArgumentException: Attempting to read data for com.google.step_count.delta, which was not requested
</code></pre>

<p>I have tried all manner of DataTypes but receive the same error everytime, what am I doing wrong?!</p>
27050359True2014-11-20 21:50:28325051136734<google-fit><google-fit-sdk>20
89
27073833Oauth.io Fitbit request not working after relaunching app<p>I am able to request Fitbit data using Oauth.io service but only as long as the app is running. Once the app relaunches the request call no longer works. Does the Fitbit token and secret need to be saved and retrieved after the app is launched ? If so, how is this done? </p>

<p>Request code I am using. I am also using the Oauth.io framework.</p>

<pre><code>[_request_object get:@"https://api.fitbit.com/1/user/-/activities/date/2012-02-25.json" success:^(NSDictionary *output, NSString *body, NSHTTPURLResponse *httpResponse)
{
NSLog(@"status code:%i\n", httpResponse.statusCode);
NSLog(@"name:%@, \n", [output objectForKey: @"steps"]);
NSLog(@"name:%@", body);
NSLog(@"name:%@", output);

}];
</code></pre>
False2014-11-22 03:50:1601814280768<fitbit><oauth.io>11
90
27078334How is it possible that Google Fit app measures number of steps all the time without draining battery?<p>The <a href="https://play.google.com/store/apps/details?id=com.google.android.apps.fitness">Google Fit</a> app, when installed, measures the duration you are walking or running, and also the number of steps <em>all the time</em>. However, strangely, using it does not seem to drain the battery. Other apps like <a href="https://play.google.com/store/apps/details?id=com.protogeo.moves">Moves</a> which seems to record number of steps pretty accurately declares that it uses a lot of power because of it constantly monitoring the GPS and the accelerometer.</p>

<p>I imagine several possibilities:</p>

<ul>
<li>Wakes up the phone every minute or so, then analyses the sensors for a few seconds and then sleeps again. However it seems that the records are pretty accurate to the minute, so the waking up must be frequent.</li>
<li>Actually turns on the accelerometer all the time, and analyzes it only after the accelerometer measurement data buffer is full. However I think the accelerometer has a small buffer to store the latest measurements.</li>
<li>Use GPS to <em>estimate</em> the number of steps instead of actually counting it. However this should not be the case, since it works even indoors.</li>
</ul>

<p>The app still feels <em>magical</em>. Counting steps the whole time without perceptible battery drain.</p>
30063262True2014-11-22 14:13:33498409811238<android><gps><accelerometer><android-sensors><google-fit>7111
91
27126522Google Fit authorization code for a in device application<p>I'm trying to get the authorization code for a in device application but I get an invalid scope error.</p>

<p>I'm making the call using this command from terminal:</p>

<pre><code>curl -d "client_id=XXX&amp;scope=https://www.googleapis.com/auth/fitness.activity.read" https://accounts.google.com/o/oauth2/device/code
</code></pre>

<p>And I'm getting this response:</p>

<pre><code>{
"error" : "invalid_scope",
"error_description" : "Not authorized to request the scopes: [https://www.googleapis.com/auth/fitness.activity.read]",
"error_uri" : "http://code.google.com/apis/accounts/docs/OAuth2.html"
}
</code></pre>

<p>Am I doing something wrong? The application is authorized for fitness api.</p>
False2014-11-25 12:16:400436555220<oauth-2.0><google-fit><google-fit-sdk>10
92
27130853How to disable Google Fit and revoke permissions from the app itself<p>I've setup app that connects to Google Fit, reads and writes some data about users body. When user disables Google Fit in apps settings, I try to revoke my apps permissions for by calling:</p>

<pre><code>public void disableGoogleFit(){
if(!mClient.isConnected()){
Log.e(TAG, "Google Fit wasn't connected");
return;
}
PendingResult&lt;Status&gt; pendingResult = Fitness.ConfigApi.disableFit(mClient);

pendingResult.setResultCallback(new ResultCallback&lt;Status&gt;() {
@Override
public void onResult(Status status) {
if(status.isSuccess()) {
Log.i(TAG, "Google Fit disabled");
}else{
Log.e(TAG, "Google Fit wasn't disabled " + status);
}
}
});
}
</code></pre>

<p>Even though I could successfully read/write data, disabling Fit returns me error: </p>

<pre><code>Google Fit wasn't disabled Status
{statusCode=unknown status code: 5010, resolution=null}
</code></pre>

<p><strong>Edit1:</strong> Added whole method, in which its visible, that client is connected at the moment I try do disable Fit.</p>
False2014-11-25 15:39:1698654380837<android><google-fit>63
93
27158645How do I retrieve step count data from Google Fitness REST api?<p>Since I installed the Google Fit app on my Nexus 5 it has been tracking my step count and time spent walking. I'd like to retrieve this info via the Google Fitness REST api (<a href="https://developers.google.com/fit/rest/" rel="noreferrer">docs</a>) but I can't work out how to get any of that data from the REST api.</p>

<p>I've used the OAuth 2.0 playground to successfully list dataSources but none of the examples I have tried have returned any fitness data whatsoever. I feel like I need to use something similar to a DataReadRequest from the (<a href="http://developer.android.com/reference/com/google/android/gms/fitness/request/DataReadRequest.html" rel="noreferrer">Android SDK</a>) but I'm not building an Android app -- I just want to access fitness data already stored by the Google Fit app.</p>

<p>Is it even possible to get the data gathered by the Google Fit app? If so, how can I read and aggregate step count data using the REST api?</p>
27177936True2014-11-26 20:51:011311485user4025880<google-api><google-fit>305
94
27163326Getting list of activities(Movements) from google fit api<p>I am creating application which can use google fit api.
I want to get all the activities(Movements) available in the google fit. Here the list of activities in google fit <a href="http://developers.google.com/fit/rest/v1/reference/activity-types" rel="nofollow">Reference</a>. </p>

<p><strong>Edited</strong></p>

<p>I know the way how to get the activities which performed by user, But i want complete list of activities which available in the google fit API (Not only the activity which performed by user, need whole list of activities) like the list available in the above link.</p>
27830681True2014-11-27 04:56:32547161829753<google-fit><google-fit-sdk>362
95
27263282Has anyone been able to get sensor data from Moto 360 via. Google Fit API?<p>I'm referring to the API described here: <a href="https://developers.google.com/fit/overview" rel="nofollow">https://developers.google.com/fit/overview</a>.</p>

<p>I have Google Fit on both my Moto360 and my phone (Nexus 4). I want to retrieve step/heart rate data from the Moto 360 via. the API, but only seem to receive the location data (from my phone) instead. Any help?</p>

<p>I used Google's sample apps located here: <a href="https://developers.google.com/fit/android/samples" rel="nofollow">https://developers.google.com/fit/android/samples</a>.</p>

<p>Thanks!</p>
False2014-12-03 03:46:10433524250468<android><bluetooth><wear-os><google-fit><moto-360>103
96
27264758add values in custom dataType Fields<p>I am trying to create and <a href="https://developers.google.com/fit/android/data-types#custom_data_types" rel="nofollow">custom datatype</a> and add value in it.</p>

<p>I have created 2 fields successfully, I am getting in call back. My code is </p>

<pre><code> // Subscribe to some data sources!
DataTypeCreateRequest request = new DataTypeCreateRequest.Builder()
// The prefix of your data type name must match your app's package name
.setName("com.fitnessapi.data_type")
// Add some custom fields, both int and float
.addField("one", Field.FORMAT_FLOAT)
.addField("two", Field.FORMAT_FLOAT)
.addField(Field.FIELD_ACTIVITY)
.build();



PendingResult&lt;DataTypeResult&gt; pendingResult = Fitness.ConfigApi.createCustomDataType(mClient, request);
request.


pendingResult.setResultCallback(
new ResultCallback&lt;DataTypeResult&gt;() {
@Override
public void onResult(DataTypeResult dataTypeResult) {
// Retrieve the created data type
DataType customType = dataTypeResult.getDataType();
System.out.println("one two" + customType.toString());


}
}
);

// [START auth_build_googleapiclient_ending]
}
</code></pre>

<p>I am not able to find any method to fill values in these 2 fields.</p>
False2014-12-03 06:02:171966822673<android><google-fit><google-fit-sdk>202
97
27432149serializeUser and deserializeUser not called; req.user always empty in PassportJS Express app<p>So I have a small app based on the generator-angular-fullstack. I want to add to the current logged user the credential for a new account (Withings).
The idea is that a user that is logged in can also add other way to make the login by using Withings or Twitter or Facebook.</p>

<p>Those are my route:</p>

<pre><code>router
.get('/', passport.authorize('withings', {
failureRedirect: '/'
}))

.get('/callback', passport.authorize('withings', {
successRedirect : '/settings',
failureRedirect : '/'
}));
</code></pre>

<p>and this the callbacks implementation :</p>

<pre><code>passport.use(new WithingsStrategy({
consumerKey: config.withings.clientID,
consumerSecret: config.withings.clientSecret,
callbackURL: config.withings.callbackURL,
passReqToCallback: true
},
function(req, token, tokenSecret, profile, done) {

console.log('user' + req.user);

return done(null, null);

}
));
</code></pre>

<p>The point is that when I get back to the function, even if I was logged the <code>req.user</code> is always <code>undefined</code>.</p>

<p>Does anyone have an idea? I read that you need a couple of function like <code>deserializeUser</code> and <code>serializeUser</code> but they are never called.</p>

<p>Ideas? I'm new on this kind of things and after 3-4 night is getting frustrated :(</p>

<p>PS: this is my configuration</p>

<pre><code> app.set('views', config.root + '/server/views');
app.engine('html', require('ejs').renderFile);
app.set('view engine', 'html');
app.use(compression());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.use(methodOverride());
app.use(cookieParser());
app.use(passport.initialize());
app.use(passport.session()); //persistent login session




// Persist sessions with mongoStore
// We need to enable sessions for passport twitter because its an oauth 1.0 strategy
app.use(session({
secret: config.secrets.session,
resave: true,
saveUninitialized: true,
store: new mongoStore({ mongoose_connection: mongoose.connection })
}));

if ('production' === env) {
app.use(favicon(path.join(config.root, 'public', 'favicon.ico')));
app.use(express.static(path.join(config.root, 'public')));
app.set('appPath', config.root + '/public');
app.use(morgan('dev'));
}

if ('development' === env || 'test' === env) {
app.use(require('connect-livereload')());
app.use(express.static(path.join(config.root, '.tmp')));
app.use(express.static(path.join(config.root, 'client')));
app.set('appPath', 'client');
app.use(morgan('dev'));
app.use(errorHandler()); // Error handler - has to be last
}
</code></pre>
False2014-12-11 20:52:2521614user4351649<passport.js><withings>112
98
27437536How to get the user's current speed using Google Fit's API?<p>Working with the Google Fit API at the moment and having a bit of trouble with the Sensors API. I'm trying to get user's current speed for my app's workouts but the documentation is a bit confusing.</p>

<p>In this code snippet is an example from Google's info page: </p>

<pre><code>Fitness.SensorsApi.add(
mClient,
new SensorRequest.Builder()
// Optional but recommended for custom data sets.
.setDataType(DataType.TYPE_SPEED)// Can't be omitted.
.setSamplingRate(1, TimeUnit.SECONDS).setAccuracyMode(SensorRequest.ACCURACY_MODE_HIGH)
.build(), mListener3)
.setResultCallback(new ResultCallback&lt;Status&gt;() {
@Override
public void onResult(Status status) {
if (status.isSuccess()) {
Log.i(TAG, "Listener registered!");
} else {
Log.i(TAG, "Listener not registered.");
}
}
});
</code></pre>

<p>//Adding a Listener</p>

<pre><code>mListener3 = new OnDataPointListener() {
@Override
public void onDataPoint(DataPoint dataPoint) {


final float speed = dataPoint.getValue(Field.FIELD_SPEED).asFloat();

runOnUiThread(new Runnable() {
@Override
public void run() {

Log.i(TAG, "In Speed" + speed );
speedTxtView.setText("" + speed );

}
});


}
</code></pre>

<p>Currently, I am getting all other datatype values like distance, heart rate ,step count and current activity but unable to get user's current speed.
Is i am doing correctly?</p>
27515749True2014-12-12 05:41:12424413110059<java><android><google-maps><google-fit>211
99
27493974IllegalArgumentException when reading data from DataReadResult<p>I am currently working on an Android app that uses Google's Fit APIs. However, when I read data from the DataReadResult,<code>DataSet ds = result.getDataSet(DataType.TYPE_STEP_COUNT_DELTA);</code> I get:</p>

<pre><code>IllegalArgumentException: Attempting to read data for com.google.step_count.delta, which was not requested
</code></pre>

<p>This is my AsyncTask that I get the DataReadResult from:</p>

<pre><code>public static class GetReadResultTask extends AsyncTask&lt;Void, Void, DataReadResult&gt; {

protected DataReadResult doInBackground(Void... voids) {
Calendar cal = Calendar.getInstance();
Date now = new Date();
cal.setTime(now);
long endTime = cal.getTimeInMillis();
cal.set(Calendar.HOUR_OF_DAY, 0);
long startTime = cal.getTimeInMillis();

DataReadRequest readRequest = new DataReadRequest.Builder()
.aggregate(DataType.TYPE_STEP_COUNT_DELTA, DataType.AGGREGATE_STEP_COUNT_DELTA)
.bucketByTime(1, TimeUnit.HOURS)
.setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS)
.build();
DataReadResult result =
Fitness.HistoryApi.readData(mClient, readRequest).await(1, TimeUnit.MINUTES);
return result;
}
}
</code></pre>

<p>How can I fix this? Any help would be appreciated.</p>
27772603True2014-12-15 22:02:2612271290539<android><google-fit>20
100
27593429HealthKit (iOS) won't deliver data in background (objC)<p>We're currently trying to get HealthKit to work in the background, in order to deliver steps data to our server when the App is closed.</p>

<p>For experimental purposes we've created a brand new iOS project in XCode, enabled HealhtKit and all background modes in Compabilities. After that, we pretty much run the code (see further down).</p>

<p>So what happens first is that the app ofcourse asks for the permissions, which we grant. What we're expecting is that the app should keep deliver the steps data every hour, to the server. But it doesnt do that, it seems like the app cant do anything when it's not active.</p>

<p>The app only deliver data when it gets resumed or started, but not at all from the background (Soft-closed / Hard-closed)</p>

<p>appdelegate.m: </p>

<pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[self setTypes];
return YES;
}


-(void) setTypes
{
self.healthStore = [[HKHealthStore alloc] init];

NSMutableSet* types = [[NSMutableSet alloc]init];
[types addObject:[HKObjectType quantityTypeForIdentifier:HKQuantityTypeIdentifierStepCount]];

[self.healthStore requestAuthorizationToShareTypes: types
readTypes: types
completion:^(BOOL success, NSError *error) {

dispatch_async(dispatch_get_main_queue(), ^{
[self observeQuantityType];
[self enableBackgroundDeliveryForQuantityType];
});
}];
}

-(void)enableBackgroundDeliveryForQuantityType{
[self.healthStore enableBackgroundDeliveryForType: [HKQuantityType quantityTypeForIdentifier: HKQuantityTypeIdentifierStepCount] frequency:HKUpdateFrequencyImmediate withCompletion:^(BOOL success, NSError *error) {
}];
}


-(void) observeQuantityType{

HKSampleType *quantityType = [HKSampleType quantityTypeForIdentifier:HKQuantityTypeIdentifierStepCount];

HKObserverQuery *query =
[[HKObserverQuery alloc]
initWithSampleType:quantityType
predicate:nil
updateHandler:^(HKObserverQuery *query,
HKObserverQueryCompletionHandler completionHandler,
NSError *error) {

dispatch_async(dispatch_get_main_queue(), ^{
if (completionHandler) completionHandler();
[self getQuantityResult];

});
}];
[self.healthStore executeQuery:query];
}


-(void) getQuantityResult{

NSInteger limit = 0;
NSPredicate* predicate = nil;

NSString *endKey = HKSampleSortIdentifierEndDate;
NSSortDescriptor *endDate = [NSSortDescriptor sortDescriptorWithKey: endKey ascending: NO];

HKSampleQuery *query = [[HKSampleQuery alloc] initWithSampleType: [HKQuantityType quantityTypeForIdentifier:HKQuantityTypeIdentifierStepCount]
predicate: predicate
limit: limit
sortDescriptors: @[endDate]
resultsHandler:^(HKSampleQuery *query, NSArray* results, NSError *error){

dispatch_async(dispatch_get_main_queue(), ^{
// sends the data using HTTP
[self sendData: [self resultAsNumber:results]];

});
}];
[self.healthStore executeQuery:query];
}
</code></pre>
30269217True2014-12-21 20:22:161439691196856<ios><iphone><xcode><healthkit><hkhealthstore>2178