08-14-2014 08:36
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

08-14-2014 08:36
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Recently my application cannot retrieve the authorization keys from fitbit. Is there any changes that I need to do ?
These are the urls we are using
- http://api.fitbit.com/oauth/request_token
- http://api.fitbit.com/oauth/access_token
- http://api.fitbit.com/oauth/authorize
Caused by: javax.net.ssl.SSLException: java.lang.RuntimeException: Could not parse key values
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:190)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1747)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1708)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.handleException(SSLSocketImpl.java:1691)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1222)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1199)
at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:434)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.jav...
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1031)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:230)
at com.fitbit.api.client.http.HttpClient.httpRequest(HttpClient.java:434)
... 191 more
Caused by: java.lang.RuntimeException: Could not parse key values
at sun.security.pkcs11.P11Key$P11ECPublicKey.fetchValues(P11Key.java:1000)
at sun.security.pkcs11.P11Key$P11ECPublicKey.getW(P11Key.java:1021)
at com.sun.net.ssl.internal.ssl.ECDHClientKeyExchange.<init>(ECDHClientKeyExchange.java:40)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverHelloDone(ClientHandshaker.java:782)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:241)
at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:593)
at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:529)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:943)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1188)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1215)
... 197 more
Caused by: java.io.IOException: DerInputStream.getLength(): lengthTag=118, too big.
at sun.security.util.DerInputStream.getLength(DerInputStream.java:544)
at sun.security.util.DerValue.init(DerValue.java:347)
at sun.security.util.DerValue.<init>(DerValue.java:277)
at sun.security.pkcs11.P11Key$P11ECPublicKey.fetchValues(P11Key.java:991)
Answered! Go to the Best Answer.

Accepted Solutions
08-21-2014 20:53
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

08-21-2014 20:53
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
this had nothing to do with the fitbit api. I looks like out admins pushed changes and we needed to restart our application servers.

08-14-2014 10:18
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


08-14-2014 10:18
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Can you please post your code. It's very hard to say for sure by stacktrace you posted, although to be honest it looks very weird as if you were using wrong functionality to encode/decode keys.
Senior Software Developer at Fitbit

08-14-2014 13:43
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

08-14-2014 13:43
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
this code worked for us for about 3 years. Starting end of July I cannot extract the keys from your side.
We did not, repeat not, push any changes to this app.

08-14-2014 14:19
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

08-14-2014 14:19
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
BTW this is the top part of that stack.
[#|2014-08-14T09:51:34.588-0500|INFO|sun-appserver2.1.1|javax.enterprise.system.stream.out|_ThreadID=36;_ThreadName=httpSSLWorkerThread-50002-4;|com.fitbit.api.FitbitAPIException: java.lang.RuntimeException: Could not parse key values
at com.fitbit.api.client.http.HttpClient.httpRequest(HttpClient.java:473)
at com.fitbit.api.client.http.HttpClient.getOauthRequestToken(HttpClient.java:169)
at com.fitbit.api.client.FitbitApiClientAgent.getOAuthTempToken(FitbitApiClientAgent.java:151)
at com.fitbit.api.client.service.FitbitAPIClientService.getResourceOwnerAuthorizationURL(FitbitAPIClientService.java:83)
at com.ui.action.FitbitAction.process(TestFitbitAction.java:82)
...

08-18-2014 15:43 - edited 08-18-2014 15:44
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

08-18-2014 15:43 - edited 08-18-2014 15:44
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Let me know what you think! PM if want the keys we are using.
It looks like the synching the steps works but I cannot get the authorization keys for new users. Something is going on.
public class FitbitAction extends WellnessAction
{
private static FitbitAPIEntityCache entityCache = new FitbitApiEntityCacheMapImpl();
private static FitbitApiCredentialsCache credentialsCache = new FitbitApiCredentialsCacheMapImpl();
private static FitbitApiSubscriptionStorage subscriptionStore = new FitbitApiSubscriptionStorageInMemoryImpl();
private String apiBaseUrl;
private String fitbitSiteBaseUrl;
private String clientConsumerKey;
private String clientSecret;
public static final String OAUTH_TOKEN = "oauth_token";
public static final String OAUTH_VERIFIER = "oauth_verifier";
private final static Log log = LogFactory.getLog( FitbitProviderDelegateImpl.class );
public String process()
{
APIResourceCredentials resourceCredentials = null;
try
{
ProviderDelegate providerDelegate = ProviderDelegateFactory.getInstance(); // Gets FITBIT impl
LocalUserDetail localUserDetail = new LocalUserDetail( "-" );
FitbitProvider fp = (FitbitProvider)providerDelegate.getProvider();
apiBaseUrl = "api.fitbit.com";
fitbitSiteBaseUrl = "http://www.fitbit.com";
clientConsumerKey = fp.getConsumerKey().trim();
clientSecret = fp.getConsumerSecret().trim();
FitbitApiClientAgent fitbitClientAgent = new FitbitApiClientAgent( apiBaseUrl, fitbitSiteBaseUrl, credentialsCache );
FitbitAPIClientService<FitbitApiClientAgent> apiClientService = new FitbitAPIClientService<FitbitApiClientAgent>( fitbitClientAgent,
clientConsumerKey, clientSecret, credentialsCache, entityCache, subscriptionStore );
FitbitAccount fitbitAccount = (FitbitAccount)providerDelegate.loadAccount( UserManager.getParticipantId() );
//
//
// Go get User persmission from www.fitbit.com to pull data down to our app
//
boolean noAccount = ( fitbitAccount == null || fitbitAccount.getTokenOne() == null || fitbitAccount.getTokenTwo() == null );
if ( noAccount && getServletRequest().getParameter( "completeAuthorization" ) == null )
{
String theDomain = getServletRequest().getRequestURL().toString();
theDomain = theDomain.substring( 0, theDomain.indexOf( "/wellness/" ) );
getServletResponse().sendRedirect(
apiClientService
.getResourceOwnerAuthorizationURL( localUserDetail, theDomain + "/wellness/fitbit/fb.action?completeAuthorization=Y" ) );
return null;
}
...
}

08-21-2014 20:53
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

08-21-2014 20:53
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
this had nothing to do with the fitbit api. I looks like out admins pushed changes and we needed to restart our application servers.

