Skip to content

Commit 01c2023

Browse files
committed
Merge pull request #74 from cc7768/master
Add OAuth2 example to docs
2 parents c39123c + 184b1f4 commit 01c2023

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

docs/index.rst

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,28 @@ measurements
1414
Quickstart
1515
==========
1616

17-
Here is some example usage::
17+
If you are only retrieving data that doesn't require authorization, then you can use the unauthorized interface::
1818

1919
import fitbit
2020
unauth_client = fitbit.Fitbit('<consumer_key>', '<consumer_secret>')
2121
# certain methods do not require user keys
2222
unauth_client.food_units()
2323

24+
Here is an example of authorizing with OAuth 1.0::
25+
2426
# You'll have to gather the user keys on your own, or try
2527
# ./gather_keys_cli.py <consumer_key> <consumer_secret> for development
2628
authd_client = fitbit.Fitbit('<consumer_key>', '<consumer_secret>', resource_owner_key='<user_key>', resource_owner_secret='<user_secret>')
2729
authd_client.sleep()
2830

31+
Here is an example of authorizing with OAuth 2.0::
32+
33+
# You'll have to gather the tokens on your own, or use
34+
# ./gather_keys_oauth2.py
35+
authd_client = fitbit.Fitbit('<consumer_key>', '<consumer_secret>', oauth2=True,
36+
access_token='<access_token>', refresh_token='<refresh_token>')
37+
authd_client.sleep()
38+
2939
Fitbit API
3040
==========
3141

0 commit comments

Comments
 (0)