From 87eab1e9bd2d97215631110c879e451812b014c0 Mon Sep 17 00:00:00 2001 From: Pat Downey Date: Thu, 31 Oct 2024 11:39:07 +0000 Subject: [PATCH] add access token to debug output --- main.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/main.go b/main.go index a43d90f..b257e4f 100644 --- a/main.go +++ b/main.go @@ -6,6 +6,7 @@ import ( "fmt" "log/slog" "net/http" + "time" "github.com/auth0/go-jwt-middleware/v2/validator" "golang.org/x/oauth2" @@ -21,6 +22,8 @@ type DebugStruct struct { Errors []string `json:",omitempty"` RegisteredClaims validator.RegisteredClaims `json:",omitempty"` Claims jwt2.Claims `json:",omitempty"` + AccessToken string `json:",omitempty"` + Expiry time.Time `json:",omitempty"` } func FlyValidator() (jwt.TokenValidator, error) { @@ -57,10 +60,14 @@ func FlyDebug() http.HandlerFunc { token, err = tokenSource.Token() + o.AccessToken = token.AccessToken + o.Expiry = token.Expiry + if err != nil { slog.Error("error getting token", "error", err) o.Errors = append(o.Errors, fmt.Errorf("error getting token: %w", err).Error()) } + if token != nil { jwtToken, err := jwt2.ParseSigned(token.AccessToken) if err != nil {