From: Florian Forster Date: Thu, 25 Jan 2018 19:46:42 +0000 (+0100) Subject: Also subscribe to the "sleep" Fitbit collection. X-Git-Url: https://git.octo.it/?p=kraftakt.git;a=commitdiff_plain;h=6c7b039b319152555c9529d8d5a2c2483cf65887 Also subscribe to the "sleep" Fitbit collection. --- diff --git a/fitbit/fitbit.go b/fitbit/fitbit.go index 04c50cd..4555e22 100644 --- a/fitbit/fitbit.go +++ b/fitbit/fitbit.go @@ -22,7 +22,12 @@ var oauth2Config = &oauth2.Config{ ClientSecret: "@FITBIT_CLIENT_SECRET@", Endpoint: oauth2fitbit.Endpoint, RedirectURL: "https://kraftakt.octo.it/fitbit/grant", - Scopes: []string{"activity", "heartrate", "profile"}, + Scopes: []string{ + "activity", + "heartrate", + "profile", + "sleep", + }, } const csrfToken = "@CSRFTOKEN@" diff --git a/gfitsync.go b/gfitsync.go index 61e9107..7f28bb0 100644 --- a/gfitsync.go +++ b/gfitsync.go @@ -130,6 +130,10 @@ func fitbitGrantHandler(ctx context.Context, w http.ResponseWriter, r *http.Requ return fmt.Errorf("c.Subscribe() = %v", err) } + if err := c.Subscribe(ctx, "sleep"); err != nil { + return fmt.Errorf("c.Subscribe() = %v", err) + } + redirectURL := r.URL redirectURL.Path = "/" redirectURL.RawQuery = ""