Download the PHP package jmitchell38488/oauth2-fitbit without Composer
On this page you can find all versions of the php package jmitchell38488/oauth2-fitbit. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jmitchell38488/oauth2-fitbit
More information about jmitchell38488/oauth2-fitbit
Files in jmitchell38488/oauth2-fitbit
Package oauth2-fitbit
Short Description OAuth 2.0 wrapper for the FitBit API using thephpleague OAuth 2.0 client
License MIT
Informations about the package oauth2-fitbit
FitBit OAuth 2.0 Provider
This package makes it simple to integrate your application with the FitBit OAuth 2.0 service provider.
Installation
Usage
The FitBit provides two different methods for authenticating with the OAuth 2.0 service, an authorization grant flow and an implicit grant flow. Both require different configuration when instantiating the provider and the implicit grant flow will require once less step.
FitBit also uses a different Authorization header than is provided by the parent library. When a user authenticates with the FitBit 2.0 API, they need to set Authorization: Basic to generate the access token, and provide the Authorization header with each subsequent request, however using Bearer instead of Basic.
Included in the package are three concrete provider classes and an abstract provider class. The abstract provider class provides shared functionality for the Authorization and Implicit implementations. The FitBit class extends the Authorization class, so you can use that instead of the Authorization class if you prefer. It is there for clarity when making authenticated requests. In any case, if you are supporting either Implicit or Authorization grant flows, you will need to keep track of which one you've used to authenticate a session, since one will timeout and you can refresh it, whereas the other will require a user to re-authorize once it has timed out.
Authorization Grant Flow
Authenticate session
Implicit Grant Flow
Authenticate session
Making requests
The API endpoints can be found in either the official API docs or the API explorer.
It's important to use the FitBit class intead of the grant flow classes, because FitBit API requires that you use the Bearer token in the Authorization header, rather than the Basic token. If you don't use the FitBit class, the API will return a 401 unauthorized error.