get_fitbit_token: Get the fitbit authentication token.

Description Usage Arguments Details Value Examples

Description

This function generates the fitbit token and performs the required API authorization.

Usage

1
2
get_fitbit_token(file_path = "~/.fitbitr", appname = NULL, key = NULL,
  secret = NULL, scope = c("activity", "heartrate", "sleep", "weight"))

Arguments

file_path

Character scalar; Path to the credentials file described in details. Leave the arguments key, secret and scope set to NULL if you want to use the credentials file for the authentication.

appname

Character scalar; Fitbit application name.

key

Character scalar; Fitbit OAuth 2.0 Client ID.

secret

Character scalar; Fitbit Client (Consumer) Secret.

scope

Character vector; API permission scope. Leave the defaults in order to access all the features listed in activity_features.

Details

Request rate limit information is stored in the fitbit token as the "rate_limit" attribute. It gets updated every time fitbit_GET is called.

Example credentials file (3 rows: appname, key, secret):

1
2
3
GetMyData
14C889
apaojsdpoj213412p4j115j1p5oj21p5o

Value

Fitbit token providing the access to your Fitbit account data.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Not run: 
## If the credentials file is located in "~/.fitbitr" just run:
fitbit_token <- get_fitbit_token()

## Else, specify the new credentials file location:

fitbit_token <- get_fitbit_token(file_path = "~/.custom_fitbitr")

## or enter the credentials as arguments:
fitbit_token <- get_fitbit_token(appname = "GetMyData",
                                 key = "14C889",
                                 secret = "apaojsdpoj213412p4j115j1p5oj21p5o"
                                 )

## End(Not run)

Avsecz/fitbitr documentation built on May 5, 2019, 9:22 a.m.