Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: the with-labstack-echo example #411

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions examples/with-labstack-echo/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 handler
err := hf(c)
if err != nil {
c.Error(err)
}
})(c.Response(), c.Request())

return nil
}
}
Expand Down
Loading