Fitbit API は、2014年11月3日から HTTPS での接続しか受け付けなくなる

On Monday, November 3, 2014, connections to api.fitbit.com will be restricted to HTTPS connections only. TLS ("SSL") will be required to use all api.fitbit.com endpoints, including all steps of OAuth.

TLS creates a secure communication channel between your application and Fitbit's API. If your application uses plaintext HTTP connections to access the Fitbit API, you need to update it to use HTTPS immediately.

For most applications, changing "http://" to "https://" on requests to api.fitbit.com and redirects to www.fitbit.com is all that is necessary to comply with this requirement.

The Fitbit API will return a HTTP 403 error to all non-HTTPS requests starting on November 3, 2014.

A "blackout test" will be performed on Tuesday, October 7, 2014, between 8–9 AM PDT. Non-HTTPS requests will fail for a brief period of time. This time will be announced here and at https://status.fitbit.com/ .

If you have questions about securely connecting to https://api.fitbit.com, please post them here.

HTTPS required starting Monday, Nov 3, 2014 - Fitbit Community

fitbit4j-1.0.26-SNAPSHOT.jar を自前ビルド

期限の今日になっても、HTTPS に対応した Fitbit4J の JAR ファイルが公式には提供されない。

なので、自分でソースコードを GitHub からダウンロードしてきて、HTTPS に対応している fitbit4j-1.0.26-SNAPSHOT.jar を作成した。
fitbit4j-1.0.26-SNAPSHOT.jar

diff: fitbit4j-1.0.25 to fitbit4j-1.0.26-SNAPSHOT

2年前にリリースされた Fitbit4J の公式最新バージョン 1.0.25 と現時点でのソースコードを比較してみる。
Comparing fitbit-parent-1.0.25...702ae28a0edf8392e20d8286f612fdcde0a27fbd · Fitbit/fitbit4j · GitHub

Different fitbit4j-1.0.25.jar to current master branch.

Different fitbit4j-1.0.25.jar to current master branch.

って、公式最新バージョンは http 決め打ちに見える。。。

Debian GNU/Linux wheezy で、 Fitbit4J の JAR ファイルを作る

Maven をインストールする。


# aptitude install maven
 
# mvn -version
Apache Maven 3.0.4
Maven home: /usr/share/maven
Java version: 1.7.0_65, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre
Default locale: ja_JP, platform encoding: UTF-8
OS name: "linux", version: "3.2.0-4-amd64", arch: "amd64", family: "unix"

ソースコードを GitHub からダウンロードして、Maven でビルドする。


$ git clone https://github.com/Fitbit/fitbit4j.git
$ cd fitbit4j/fitbit4j
$ mvn clean compile jar:jar

fitbit4j-1.0.26-SNAPSHOT.jar が生成された。


$ ls -la ./target/
total 212
drwxr-xr-x 5 alice alice   4096 Nov  3 17:16 .
drwxr-xr-x 4 alice alice   4096 Nov  3 17:16 ..
drwxr-xr-x 3 alice alice   4096 Nov  3 17:16 classes
-rw-r--r-- 1 alice alice 191920 Nov  3 17:16 fitbit4j-1.0.26-SNAPSHOT.jar
drwxr-xr-x 3 alice alice   4096 Nov  3 17:16 generated-sources
drwxr-xr-x 2 alice alice   4096 Nov  3 17:16 maven-archiver

ref.

tags: fitbit fitbit4j

Posted by NI-Lab. (@nilab)