From b0da2d60a152139846423097f0bfd359a82eb2df Mon Sep 17 00:00:00 2001 From: furkansenharputlu Date: Wed, 1 May 2024 14:05:12 +0300 Subject: [PATCH] fix: the with-labstack-echo example --- CHANGELOG.md | 1 + examples/with-labstack-echo/main.go | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f1d503c4..ebb4886a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `session.CreateNewSession` now defaults to the value of the `st-auth-mode` header (if available) if the configured `config.GetTokenTransferMethod` returns `any`. - Enable smooth switching between `useDynamicAccessTokenSigningKey` settings by allowing refresh calls to change the signing key type of a session. - Make session required during signout. +- Fix the `with-labstack-echo` example. ## [0.17.5] - 2024-03-14 - Adds a type uint64 to the `accessTokenCookiesExpiryDurationMillis` local variable in `recipe/session/utils.go`. It also removes the redundant `uint64` type forcing needed because of the untyped variable. diff --git a/examples/with-labstack-echo/main.go b/examples/with-labstack-echo/main.go index a080f934..e67ca205 100644 --- a/examples/with-labstack-echo/main.go +++ b/examples/with-labstack-echo/main.go @@ -3,10 +3,11 @@ package main import ( "encoding/json" "errors" - "github.com/supertokens/supertokens-golang/recipe/dashboard" "net/http" "strings" + "github.com/supertokens/supertokens-golang/recipe/dashboard" + "github.com/labstack/echo/v4" "github.com/supertokens/supertokens-golang/recipe/emailverification" "github.com/supertokens/supertokens-golang/recipe/emailverification/evmodels" @@ -200,8 +201,14 @@ func verifySession(options *sessmodels.VerifySessionOptions) echo.MiddlewareFunc return func(c echo.Context) error { session.VerifySession(options, func(rw http.ResponseWriter, r *http.Request) { c.Set("session", session.GetSessionFromRequestContext(r.Context())) - hf(c) + + // Call the next handler + err := hf(c) + if err != nil { + c.Error(err) + } })(c.Response(), c.Request()) + return nil } }