package auth import ( "net/http" ory "github.com/ory/client-go" ) func LogOutHandler(oryClient *ory.APIClient, tunnelURL string) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { cookies := r.Header.Get("Cookie") logoutFlow, _, err := oryClient.FrontendAPI.CreateBrowserLogoutFlow(r.Context()).Cookie(cookies).Execute() if err != nil { http.Redirect(w, r, "/", http.StatusSeeOther) return } http.Redirect(w, r, logoutFlow.LogoutUrl, http.StatusSeeOther) } }