These allow users to actively delete their tokens. This change also
includes:
* Rename the "setup" endpoints to "connect".
* Enforce authentication for the "connect" endpoints, even though they
don't really require it. It's better to handle authentication before
redirecting users to the OAuth screen.
var delayedHandleNotifications = delay.Func("handleNotifications", handleNotifications)
func init() {
var delayedHandleNotifications = delay.Func("handleNotifications", handleNotifications)
func init() {
- http.HandleFunc("/fitbit/setup", fitbitSetupHandler)
+ http.Handle("/fitbit/connect", AuthenticatedHandler(fitbitConnectHandler))
http.Handle("/fitbit/grant", AuthenticatedHandler(fitbitGrantHandler))
http.Handle("/fitbit/notify", ContextHandler(fitbitNotifyHandler))
http.Handle("/fitbit/grant", AuthenticatedHandler(fitbitGrantHandler))
http.Handle("/fitbit/notify", ContextHandler(fitbitNotifyHandler))
- http.HandleFunc("/google/setup", googleSetupHandler)
+ http.Handle("/fitbit/disconnect", AuthenticatedHandler(fitbitDisconnectHandler))
+ http.Handle("/google/connect", AuthenticatedHandler(googleConnectHandler))
http.Handle("/google/grant", AuthenticatedHandler(googleGrantHandler))
http.Handle("/google/grant", AuthenticatedHandler(googleGrantHandler))
+ http.Handle("/google/disconnect", AuthenticatedHandler(googleDisconnectHandler))
http.Handle("/", AuthenticatedHandler(indexHandler))
}
http.Handle("/", AuthenticatedHandler(indexHandler))
}
-func fitbitSetupHandler(w http.ResponseWriter, r *http.Request) {
+func fitbitConnectHandler(_ context.Context, w http.ResponseWriter, r *http.Request, _ *app.User) error {
http.Redirect(w, r, fitbit.AuthURL(), http.StatusTemporaryRedirect)
http.Redirect(w, r, fitbit.AuthURL(), http.StatusTemporaryRedirect)
}
func fitbitGrantHandler(ctx context.Context, w http.ResponseWriter, r *http.Request, u *app.User) error {
}
func fitbitGrantHandler(ctx context.Context, w http.ResponseWriter, r *http.Request, u *app.User) error {
<span class="status">Disconnected</span>
</td>
<td class="action">
<span class="status">Disconnected</span>
</td>
<td class="action">
- <a href="/fitbit/login" class="button flat">Connect</a>
+ <a href="/fitbit/connect" class="button flat">Connect</a>
<span class="status">Disconnected</span>
</td>
<td class="action">
<span class="status">Disconnected</span>
</td>
<td class="action">
- <a href="/google/login" class="button flat">Connect</a>
+ <a href="/google/connect" class="button flat">Connect</a>