correct env vars

This commit is contained in:
Matthieu Lamalle 2020-07-27 09:34:24 +02:00
parent 3f03090762
commit 8d8bdd175a
1 changed files with 3 additions and 9 deletions

View File

@ -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{})