From 8d8bdd175aa9d2e3bce1a4c436bcb4167de3535e Mon Sep 17 00:00:00 2001 From: Matthieu Lamalle Date: Mon, 27 Jul 2020 09:34:24 +0200 Subject: [PATCH] correct env vars --- middleware/accounts.go | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/middleware/accounts.go b/middleware/accounts.go index 6d56422..efec9ef 100644 --- a/middleware/accounts.go +++ b/middleware/accounts.go @@ -38,7 +38,7 @@ func init() { if err != nil { panic(err) } - refreshExpiration, err = strconv.Atoi(os.Getenv("jwt_access_expiration")) + refreshExpiration, err = strconv.Atoi(os.Getenv("jwt_refresh_expiration")) if err != nil { panic(err) } @@ -246,12 +246,6 @@ var Refresh = func(w http.ResponseWriter, r *http.Request) { resp["access_token"] = acc.Token resp["refresh_token"] = acc.RefreshToken - //update refresh expirity - - // rt := time.Now().Add(time.Minute * time.Duration(refreshExpiration)).Unix() - // log.Println(rt) - // db.Model(&acc).Update(acc.TokenExpiresAt, rt) - respond(w, resp) } @@ -260,9 +254,9 @@ func ValidateToken(w http.ResponseWriter, r *http.Request) (*TokenDetails, error var pwd string urltomatch := r.URL.String() if strings.Contains(urltomatch, "/api/user/refresh") { - pwd = "refresh_token_password" + pwd = "jwt_refresh_token_password" } else { - pwd = "access_token_password" + pwd = "jwt_access_token_password" } response := make(map[string]interface{})